[Haskell-cafe] Announcing OneTuple-0.1.0
Derek Elkins
derek.a.elkins at gmail.com
Fri Oct 3 17:20:48 EDT 2008
On Fri, 2008-10-03 at 15:38 -0400, David Menendez wrote:
> On Fri, Oct 3, 2008 at 3:17 AM, Jason Dusek <jason.dusek at gmail.com> wrote:
> > Perhaps I am lacking in imagination, but I still can't see the
> > value of one tuples.
>
> You can use them to defeat seq.
>
> undefined `seq` x == undefined
> OneTuple undefined `seq` x == x
>
> That might be useful if a polymorphic function is using seq to force
> evaluation, and you don't want it to. But I can't imagine that coming
> up much in practice.
Think element strict polymorphic containers, e.g.
data HeadStrictList a = Nil | Cons !a (HeadStrictList a)
then
type LazyList a = HeadStrictList (OneTuple a)
More information about the Haskell-Cafe
mailing list