[Haskell-cafe] Hoogle? [Stacking monads]

Andrew Coppin andrewcoppin at btinternet.com
Wed Oct 8 15:11:05 EDT 2008


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...



More information about the Haskell-Cafe mailing list