seq -> force
John Meacham
john at repetae.net
Sun Jun 5 13:52:39 CEST 2011
On Sun, Jun 5, 2011 at 4:01 AM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
>
> For a datatype like
> data T a = Cons a
> I could define 'seq' myself as
> seq (Cons _) x = x
> if it would be a type class method.
>
> Is there a type class for generating the constructor independently from the
> input, as in:
> force ~(Cons x) = Cons x
> ?
So force will "push down" the lazyness one level in some sense? Would this only
work for unary constructors of data declarations (not newtypes)?
so
force _|_ = Cons _|_
John
More information about the Libraries
mailing list