[Haskell-cafe] Hoogle? [Stacking monads]
reiner.pope at gmail.com
Wed Oct 8 19:35:12 EDT 2008
The syntax is for the implicit parameter extension. 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
On Thu, Oct 9, 2008 at 6:11 AM, Andrew Coppin
<andrewcoppin at btinternet.com>wrote:
> 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,
>> ?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
> 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 at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe