Quantcast

Monad Laws and Do Notation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Monad Laws and Do Notation

diazepan
I've got this expression

expression = do
        w <- "hello"
        y <- "to you"
        return w

I wanna know how can I reduce it using monad laws
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Monad Laws and Do Notation

Ivan Lazar Miljenovic
On 22 September 2011 11:46, diazepan <[hidden email]> wrote:
> I've got this expression
>
> expression = do
>        w <- "hello"
>        y <- "to you"
>        return w
>
> I wanna know how can I reduce it using monad laws

I don't think you can: the best you can do is minimise it with other
monadic functions.  The general case you can do something like discard
from polyparse:
http://hackage.haskell.org/packages/archive/polyparse/latest/doc/html/Text-ParserCombinators-Poly-Base.html#v:discard

--
Ivan Lazar Miljenovic
[hidden email]
IvanMiljenovic.wordpress.com

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Loading...