
Can anyone point me in the direction of some explanatory material on the motivation behind empty data declarations? I have read the GHC manual on this, but am none the wiser for it. Googling does not seem to turn up much either, although I may not have tried hard enough. When and why might this language extension be useful? - P -

On Wed, Apr 3, 2013 at 9:01 PM, Philippe Sismondi
Can anyone point me in the direction of some explanatory material on the motivation behind empty data declarations?
You could start here: https://github.com/yairchu/red-black-tree/blob/master/RedBlackTree.hs The big picture is defining constants. A declaration like "data Bool = True | False" defines constants at the term-level. Terms are always typed. A declaration like "data Z" defines constants at the type-level. Types are always kinded, typically of kind * (what Z is). The recent introduction of a Constraint kind expands the possibilities of type-level programming. Same for polymorphic kinds. -- Kim-Ee

On Wed, Apr 3, 2013 at 9:01 PM, Philippe Sismondi
Googling does not seem to turn up much either, although I may not have tried hard enough.
If you google "phantom types" instead of "empty data declarations" you should get more hits. Hinze wrote a piece called "Fun with Phantom Types" that's pitched at an intro level. -- Kim-Ee

Ok, thanks for the replies you guys. They give me some places to start. I clearly also need to pick up my study of types again. - P - On 2013-04-03, at 10:01 AM, Philippe Sismondi wrote:
Can anyone point me in the direction of some explanatory material on the motivation behind empty data declarations? I have read the GHC manual on this, but am none the wiser for it. Googling does not seem to turn up much either, although I may not have tried hard enough.
When and why might this language extension be useful?
- P - _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (2)
-
Kim-Ee Yeoh
-
Philippe Sismondi