[Haskell-cafe] Monad Syntax
Henning Thielemann
lemming at henning-thielemann.de
Mon Dec 13 22:30:23 CET 2010
On Mon, 13 Dec 2010, caseyh at istar.ca wrote:
> do
> let x = 7
> y <- x+1, Writer ("inc\n")
> z <- 2*y, Writer ("double\n")
> z-1, Writer ("dec\n")
>
> Or some other delimiter than the comma?
You can simply define your own syntax using an infix operator, say:
a # str = Writer (a, str)
do
let x = 7
y <- x+1 # "inc\n"
z <- 2*y # "double\n"
z-1 # "dec\n"
More information about the Haskell-Cafe
mailing list