Version française
Home     About     Download     Resources     Contact us    
Browse thread
'_a
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Walter <michael.walter@g...>
Subject: Re: [Caml-list] Re: '_a
On 29 Jan 2005 02:48:20 +1100, skaller <skaller@users.sourceforge.net> wrote:
> [...]
> >  OCaml already has
> > one: return is implicit, bind is called ";", and the monad operations
> > include "raise" and "try ... with ...".
> 
> Indeed, but that isn't necessarily a good monad
> for all purposes (otherwise Haskell would be Ocaml
> and wouldn't have any typeclasses .. LOL :)
This is indeed pretty much the IO monad (AFAIK O'caml).

return: (implicit)
>>: ;
fail: raise

catch: try ... with ... (not part of the Monad type class)

> In particular, raise is very nasty -- I can't say this
> very well, but 'the monad is too global'. It's way too
> powerful -- and thus too hard to reason about.
Hum.

> You can't predict what a function will throw from its
> interface, so you basically have lost control of your program.
> 
> As I understand it, Haskell style monads provide
> better localisation (is that right?)
As you define binding by yourself, you have all possibilities to
propagate errors, such as implementation exceptions, etc. Simple
examples are Maybe and Either. And IO, obviously ;-)

Michael