Simon Peyton-Jones wrote:
[snip]
> 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)

to mean

       MkBar f = :MkBar (f `seq` (\x -> x `seq` f x))

In that case,
       case (MkBar bot) of MkBar f -> f `seq` 0
would diverge.

Roberto.
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to