More speed please!
zunino at di.unipi.it
Fri Mar 16 15:06:07 EDT 2007
Simon Peyton-Jones wrote:
> Now you are proposing that
> data Bar a = MkBar (!a -> a)
> MkBar f = :MkBar (\x. x `seq` f x)
> I suppose you can combine the two notations:
> data Baz a = MkBaz !(!a -> a)
> MkBaz f = f `seq` :MkBaz (\x. x `seq` f x)
> Interesting. Is that what you meant? An undesirable consequence
> would be that
> case (MkBar bot) of MkBar f -> f `seq` 0
> would return 0, because the MkBar constructor puts a lambda inside.
> This seems bad. Maybe you can only put a ! inside the function type if
> you have a bang at the top (like MkBaz).
Another possible fix could be defining
data Bar a = MkBar (!a -> a)
MkBar f = :MkBar (f `seq` (\x -> x `seq` f x))
In that case,
case (MkBar bot) of MkBar f -> f `seq` 0
More information about the Glasgow-haskell-users