[Haskell-beginners] Maybe monad and computations
Emmanuel Touzery
etouzery at gmail.com
Sat Sep 7 09:43:39 CEST 2013
Yes, I agree there is no need in the GHC version to wrap it with return,
you can imagine that "operation" instead asks the user through the command
line which operation to do, (++) or just pick the first or the second
string for instance. In that case it would really need the IO monad and
that is my situation.
I didn't take the time to code it for the purpose of the example but that
is my problem. In that case liftM2 offers me a solution, I can use it also
to call functions operating in another monad than the one the parameters
are in. In Fay I have that problem with Fay monad, and I don't know why.
It's more a Fay question, but Fay normally uses GHC for typecheck so I
thought it's maybe something with the Fay monad that is obvious for someone
more knowledgeable than me.
emmanuel
On Sat, Sep 7, 2013 at 9:38 AM, Daniel Trstenjak <daniel.trstenjak at gmail.com
> wrote:
>
> > I can't see how even your GHC version of 'operation' should work ...
>
> Ok, the GHC version puts the IO action into the Maybe and returns it then
> from 'process'. There's really no need for this extra wrapping of the
> string
> into the IO monad.
>
> I know nothing about Fay, so I don't know why this extra wrapping shouldn't
> work for Fay. Fay has an instance for Monad, right?
>
>
> Greetings,
> Daniel
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130907/434f5270/attachment.htm>
More information about the Beginners
mailing list