Re: [Haskell-cafe] Are all monads functions?

2012-01-09 Thread wren ng thornton
On 12/31/11 8:18 AM, Yves Parès wrote: Thanks for the explanation on free monads, it's interesting. But still, I maintain my previous view. I could clarify that by saying that (e.g. for Maybe) we could separate it in two types, Maybe itself and its monad: -- The plain Maybe type data Maybe a =

[Haskell-cafe] Are all monads functions?

2011-12-31 Thread Yves Parès
Hello Café, One thought occur to me recently when explaining the concept of Monad to non-haskellers: internally, all standard Monads are newtypes wrapping functions: StateT is, WriterT is, ContT is. Even IO and ST are, both conceptually and in their implementation by GHC. ParsecT (not part of

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Jerzy Karczmarczuk
Yves Parès : all standard Monads are newtypes wrapping functions What about Maybe and [] ? Jerzy Karczmarczuk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Stephen Tetley
On 31 December 2011 12:26, Jerzy Karczmarczuk jerzy.karczmarc...@unicaen.fr wrote: Yves Parès : all standard Monads are newtypes wrapping functions What about Maybe and [] ? And Identity ... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Yves Parès
Maybe and [] have still the same meaning: they can be seen as functions: - they represent the result(s) that might or might not have a computation - *they have to be called/ran/executed* (wichever term you prefer) through Data.Maybe.maybe or Data.List.foldX, so that we can extract some value out

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Roman Cheplyaka
* Yves Parès limestrael+hask...@gmail.com [2011-12-31 13:09:37+0100] One thought occur to me recently when explaining the concept of Monad to non-haskellers: internally, all standard Monads are newtypes wrapping functions: StateT is, WriterT is, ContT is. Even IO and ST are, both conceptually

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Yves Parès
Thanks for the explanation on free monads, it's interesting. But still, I maintain my previous view. I could clarify that by saying that (e.g. for Maybe) we could separate it in two types, Maybe itself and its monad: -- The plain Maybe type data Maybe a = Just a | Nothing -- The MaybeMonad

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Chris Smith
On Dec 31, 2011 8:19 AM, Yves Parès limestrael+hask...@gmail.com wrote: -- The plain Maybe type data Maybe a = Just a | Nothing -- The MaybeMonad newtype MaybeMonad a = MM ( () - Maybe a ) That's what using Maybe as a monad semantically means, doesn't it? I'd have to say no. That Maybe

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Steve Horne
On 31/12/2011 13:18, Yves Parès wrote: But still, I maintain my previous view. I could clarify that by saying that (e.g. for Maybe) we could separate it in two types, Maybe itself and its monad: -- The plain Maybe type data Maybe a = Just a | Nothing -- The MaybeMonad newtype MaybeMonad a =

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Ertugrul Söylemez
Yves Parès limestrael+hask...@gmail.com wrote: But still, I maintain my previous view. I could clarify that by saying that (e.g. for Maybe) we could separate it in two types, Maybe itself and its monad: -- The plain Maybe type data Maybe a = Just a | Nothing -- The MaybeMonad newtype

Re: [Haskell-cafe] Are all monads functions?

2011-12-31 Thread Conal Elliott
In that sense every value in maths is a function. In other words: Your extension of everything (!) to functions is redundant. And function is not unique in this way. All types can be embedded into pairs also, e.g., newtype MyInt = MyInt ((),Int), or newtype MyInt = MyInt (((),Int),()), etc.