
The syntax is for the implicit parameter extension[1]. I think you would
write your example as
foo (undefined :: Bar x) ?z :: Bar y
Then querying the type of that whole expression with :t will list ?z's type
in the expression's constraints. (Of course, you should turn off the
monomorphism restriction so that ghc doesn't complain if constraints aren't
resolved).
[1]:
http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extension...
Reiner
On Thu, Oct 9, 2008 at 6:11 AM, Andrew Coppin
Ryan Ingram wrote:
There is such a tool, it's called ghci :) It just takes a bit of massaging to do what you want:
ghci> :set -fglasgow-exts ghci> :t (?f some_func [?a .. ?b])
Here's an example: Prelude> :t ?f map [?a .. ?b] ?f map [?a .. ?b] :: forall t a b t1. (Enum t1, ?b::t1, ?a::t1, ?f::((a -> b) -> [a] -> [b]) -> [t1] -> t) => t
This tells you the types the variables have to have, and the type of the expression.
Judicious use of (undefined :: type_signature) can also help.
Using undefined is already a standard technique for me. But what it doesn't let you do is
foo (undefined :: Bar x) (undefined) :: Bar y -- What type is the second argument?
I'm curios as to how the example you give actually works - I don't recognise that syntax at all...
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe