Re: ADTs in Haskell

1993-10-04 Thread wadler
Lennart makes the point that a different generalisation of Simon's suggestion, namely strict constructors, would be more useful. Perhaps. A point in favour of my suggestion is that unlifted products have an easy semantic definition. What, precisely, is the definition of a constructor strict

Re: ADTs in Haskell

1993-10-04 Thread Lennart Augustsson
What, precisely, is the definition of a constructor strict in a specified field? In particular, how do you define it, and implement it, if that field has a functional type? Remember, in Haskell function types are unlifted, so we should have (\_ - bottom) = bottom. Well, if you go for

Re: ADTs in Haskell

1993-10-04 Thread Lennart Augustsson
Phil suggests that we add newtype T a_1 ... a_k = C t_1 ... t_n and use that to construct non-lifted ADTs. While this works well, I'd prefer to have strictness annotations on construtors instead. Haskell has very few means for making programs more efficient when you really need

Re: ADTs in Haskell

1993-10-03 Thread wadler
The idea that all ADT's must be `lifted' appears clunkier and clunkier over time, so I support Simon's suggestion. Note that Simon's suggestion can be easily generalised. Our current declaration form is datatype T a_1 ... a_k = C t_1 ... t_n | ... Simon suggests we add

ADTs in Haskell

1993-10-01 Thread Simon L Peyton Jones
Gentle Haskell-1.3 people, This message argues for a particular approach to abstract data types in Haskell. The problem ~~~ We have long been a bit unhappy with Haskell's treatment of abstract data types. It's easy to make a new algebraic data type abstract, just by not exporting its