[Haskell-cafe] constant functions
Donald Bruce Stewart
dons at cse.unsw.edu.au
Wed Dec 27 23:32:02 EST 2006
> Hi Donald,
> I think you misunderstood what I was asking. There's
> not two cases. Maybe I'm not saying it sufficiently
> well but the function ALWAYS just returns a function
> that always returns the original argument to ALWAYS no
> matter what else you give the resulting function.
> when one is define as follows
> one = always 1
> > one 4
> > one "abc"
> > one (2,3)
> > one [0,4,8,2]
> > map one ["one","two","three"]
> The mapping example is just an alternative way of
> illustrating the functionality. No matter what the
> defined function is given it always gives back the
> original value give to ALWAYS.
Ah yes, I must have missed the 'map one' in the original post.
Hence I thought you were looking for different behaviour for lists.
My mistake. Prelude.const is your friend :-)
More information about the Haskell-Cafe