RFC for a change in EmptyDataDecls instance deriving
Roman Cheplyaka
roma at ro-che.info
Wed Jul 15 20:18:25 UTC 2015
On 15/07/15 18:56, Ömer Sinan Ağacan wrote:
> Haskell 2010 doesn't support data types without any constructors(aka. empty
> data type)[1].
Haskell 2010 does support data types without constructors:
https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-690004.2.1
> 1. What do you think is the right way to derive instances for empty data types?
> An `error` or pattern match on bottom argument(e.g. empty case)?
The right question is whether the methods should be strict in the arguments of empty types.
The strict version can be implemented with an empty case (which is stylistically nicer),
or with error + seq/bang patterns; it doesn't matter.
I agree that the derived methods should be strict.
> 2. Do you think with EmptyDataDecls and StandaloneDeriving, `deriving(..)` and
> standalone deriving should derive same instances?
Certainly.
> 3. Should we change instances of Void on the way, for consistency? (Ord and Eq
> especially)
Yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150715/6c1a5d39/attachment.sig>
More information about the Libraries
mailing list