[Haskell-cafe] [] vs [()]
Jonathan Cast
jonathanccast at fastmail.fm
Fri Oct 10 13:56:01 EDT 2008
On Fri, 2008-10-10 at 10:59 -0700, Daryoush Mehrtash wrote:
> I was in fact trying to figure out how "guard" worked in the "do".
> The interesting (for a beginner) insight is that:
>
> [()] map f = [f]
I don't think any clarity is added by made-up notation. I think you
mean
map f [()] = [f ()]
or
[()] >>= f = f ()
or
[()] >> f = f
or
do
[()]
f
= f
or
[ f | _ <- [()] ] = [ f ]
> --( just as any list with one element would have been such
> as [1] map f = [f] ) where as
>
> [] map f = []
And
map f [] = []
or
[] >>= f = []
or
[] >> f = []
or
do
[]
f
= []
or
[ f | _ <- [] ] = []
jcc
More information about the Haskell-Cafe
mailing list