[Haskell-cafe] [] vs [()]
Daryoush Mehrtash
dmehrtash at gmail.com
Fri Oct 10 14:14:55 EDT 2008
I don't think any clarity is added by made-up notation. I think you
mean
In fact I was "trying" to be correct on this. Is it wrong to show:
[()] >> f = f
as was doing:
[()] map f = [f]
I want to say map function f over a single element list will yield a list of
single element, the element being function f.
daryoush
On Fri, Oct 10, 2008 at 10:56 AM, Jonathan Cast
<jonathanccast at fastmail.fm>wrote:
> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081010/4f63126d/attachment.htm
More information about the Haskell-Cafe
mailing list