[Haskell-cafe] Martin Odersky on "What's wrong with Monads"
neto at netowork.me
Mon Jun 25 19:27:54 CEST 2012
Monads are something optional at the end. Even the IO Monad is an optional
pattern with unsafePerformIO, but we use it because one of the reasons we
love Haskell is it's ability to differentiate pure and impure functions.
But sadly this is one of the traits we love about Haskell but others
dislike about it.
On Mon, Jun 25, 2012 at 2:23 PM, Alberto G. Corona <agocorona at gmail.com>wrote:
> My pocket explanation:
> While e a function gives one only value of the codomain for each element
> of the domain set (and thus it can be evaluated a single time), a category
> is a generalization that accept many graphs that goes from each element of
> the domain to the codomain. For that matter getChar can be understood
> mathematically only using cathegory theory. To discover where the chain of
> graphs goes each time, it is necessary to execute the chain of sentences.
> Imperative languages works "categorically" every time, so they don´t need
> an special syntax for doing so. Haskell permits to discriminate functional
> code from "normal" "categorical/imperative" code, so the programmer and the
> compiler can make use of the mathematical properties of functions. For
> example, graph reduction thank to the uniqueness of the paths.
> Besides that, everything, functional or monadic is equally beatiful and
> polimorphic. i don´t think that monadic code is less fine. It is
> unavoidable and no less mathematical.
> 2012/6/25 Anton Kholomiov <anton.kholomiov at gmail.com>
>> The class you're looking for is Applicative. The (<*>) operator handles
>> application of "effectful" things to "effectful" things, whereas (<$>)
>> handles the application of non-"effectful" things to "effectful" things.
>> This situation is interesting because it highlights the fact that there is
>> a distinction between the meaning of whitespace between function and
>> argument vs the meaning of whitespace between argument and argument.
>> `Applicative` is not enough for monads.
>> `Applicative` is like functor only for functions
>> with many arguments. It's good for patterns:
>> (a -> b -> c -> d) -> (m a -> m b -> m c -> m d)
>> Monads are good for patterns
>> (a -> b -> c -> m d) -> (m a -> m b -> m c -> m d)
>> So I can not express it with `Applicative`. My
>> analogy really breaks down on functions with
>> several arguments, since as you have pointed out there are
>> two white spaces. But I like the idea of using
>> one sign for normal and monadic and maybe applicative
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe