[Haskell-beginners] Data declarations
Brandon Allbery
allbery.b at gmail.com
Fri Jun 3 17:44:52 CEST 2011
On Fri, Jun 3, 2011 at 09:37, aditya siram <aditya.siram at gmail.com> wrote:
>> One more question, out of curiosity: In your above example, you could change
>>
>> data Populated = Populated
>> data New = New
>>
>> to simply
>>
>> data Populated
>> data New
>>
>> correct? You might as well, right, since your constructors take no
>> values, and you are just using them as phantom types?
>
> Yes I think that's correct. You might also look at GADT's [1] which
> cover some of the same use-cases.
The reason for the former is that the latter is not accepted by
Haskell 98, so it's a little less portable.
More information about the Beginners
mailing list