Perspectives on learning and using Haskell

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Wed Dec 24 16:22:46 EST 2003


On Wed, Dec 24, 2003 at 10:39:33AM +0000, Graham Klyne wrote:
> 
> It now seems to me that (some?) Monads are kinds of Functors, generalized 
> to handle the "no value" case, and also composition.
> 
> This also had me thinking about sequence:  is there a generalization to 
> arbitrary monads that rearranges the monadic structure?

Perhaps looking into Category Theory could be enlightening for both of
us - terms Monad and Functor where both taken from there.

> >11 and 18.
> >   If you define an instance of Monad for ((->) e) then
> >
> >      return (putStrLn "Hello!") 'x'
> >
> >   is a proper IO () value. Probably still not sensible ;)
> 
> Ah, I think I see your point.  It would apply where monads are "nested", 
> right?

Exactly.

> >   Special treatment of 'return' could be helpful, but I am afraid that
> >   it could also make it look special, like a return keyword in C.
> 
> I certainly wouldn't argue for special treatment _in the language_, but 
> OTOH, I think it might be helpful if compiler diagnostics hinted at the 
> possibility when a type error is detected in a form like return x y.

Agreed.

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links


More information about the Haskell-Cafe mailing list