[Haskell-cafe] Re: beginner's problam with a monad
Benjamin Franksen
benjamin.franksen at bessy.de
Sun Sep 3 14:53:56 EDT 2006
Julien Oster wrote:
> Now if anyone could enlighten me about the "instance Monad Tracker a"
> instead of "instance Monad Tracker" part, everything will be clear!
Hello Julien,
The way you defined it, Tracker is a type constructor with two arguments,
both of which are types; another way to state this is to say that Tracker
has kind (* -> * -> *). However, a monad is a type constructor with kind
* -> *, i.e. it accepts only one type argument. This can be seen from the
class definition, where m is always used with one argument (i.e. 'm a'
or 'm b' and a and b are types).
Partially applying Tracker to one argument ('T a') gives you a type
constructor that has only one remaining 'open' argument and thus can be
made an instance of class Monad.
HTH,
Ben
More information about the Haskell-Cafe
mailing list