[Haskell-beginners] in which monad am I?

Francesco Guerrieri f.guerrieri at gmail.com
Sun Jan 3 17:21:20 EST 2010

On Sun, Jan 3, 2010 at 11:06 PM, Rahul Kapoor <rk at trie.org> wrote:
> I am not sure I completely understand your question (I think I do)

It appears that you did. Thanks!

> ghci is able to infer that the Monad's in question are the Maybe and
> List respectively.
> In (almost?) all cases type inference allows the compiler to pick
> which overloaded
> implementation is to be used.

Why did you put the "almost"? Given the types on which the function is acting,
either it finds a good match or not, in which case it is a
compile-time error. What am I missing?

>>and do poor
>> haskell programmers never feel the need to explicitly state to which
>> monad they "wish to lift" ?
> It is probably a matter of taste - but adding type signatures even in
> the presence
> of type inference is usually a good thing except for the most trivial cases It
> serves as a documentation and a quick test by making sure that the
> compiler and you
> infer the same type since it is a compile error to specify a type
> which is not compatible
> with what the compiler infers.

Great, I didn't recall that a wrong annotation was a compile error.


More information about the Beginners mailing list