Proposal: Strict types
Bas van Dijk
v.dijk.bas at gmail.com
Fri Feb 18 11:59:39 CET 2011
On 18 February 2011 02:23, Edward Z. Yang <ezyang at mit.edu> wrote:
> As an alternative to moving 1-5 into base, we can place them in the Haskell
> Platform.
+1 for this alternative.
> 6. Syntax extension for anonymous strict types
>
> If I have a type (a, b), and I would like to make it strict in
> the first argument, I have to create a new data type. This syntax
> extension would permit me to create such data type simply by writing (!a, b).
>
> This is probably going to be difficult, so here are some possible
> implementation strategies:
>
> * Such syntax is simply sugar for creating an anonymous data type
> with those properties. Coercions would need to be specified
> manually. Type inference errors might become harder to diagnose.
>
> * We modify all types to have a strictness bit and modify the
> inference algorithm to propagate these bits. It sounds like
> a fascinating research problem with a paper at the end, if it
> actually works.
>
> If this is implemented, it supersedes all of the previous points
> (and in fact, probably many of the .Strict modules that currently exist,
> if application of strictness is strictly (ahem) mechanical.)
That would be really nice! It has always felt strange I could write:
data Maybe' a = Nothing | Just !a
but not:
type Maybe' a = Maybe !a
Regards,
Bas
More information about the Libraries
mailing list