Hi all, I've been reading the gentle introduction to Haskell a bit more closely today and there a few things which I can't quite understand (presumably because they are typo's). I've found two issues with the "Using monads" section [1]. Not sure if this is the right place to report this, but there's probably somewhere here who can fix it :-)
The first one is in the state monad data type. It reads:
data SM a = SM (S -> (a,S)) -- The monadic type
I can't seem to find out what "S" is exactly here. It seems to be a
universally quantified type variable, but then it should be lowercase.
Considering that it is referred to later on as "s", I suspect this is a type?
Further on, a resource monad is described. Here, a lift1 function is given
to allow one to lift a normal computation into a resource aware computation,
with the following type signature:
lift1 :: (a -> b) -> (R a -> R b)
A few lines down, the inc operation is defined as follows:
inc i = lift1 (i+1)
To me, this seems wrong. Even without going into the semantics, it seems that
the (i+1) expression does not satisfy the type of the first argument to lift1.
I suspect this should have been:
inc = lift1 (+1)
Gr.
Matthijs
[1]: http://www.haskell.org/tutorial/monads.html#sect9.3
signature.asc
Description: Digital signature
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
