data families syntax

Harendra Kumar harendra.kumar at gmail.com
Sun Nov 13 10:40:05 UTC 2016


I am curious about why the data families syntax was chosen to be the way it
is. For example a list can be defined as follows:

data family List a

data instance List Char = Empty | Cons Char (List Char)

data instance List ()   = Count Int


Instead why not define it as:

data List :: * -> *

data List Char = Empty | Cons Char (List Char)

data List ()   = Count Int


The latter form looks more intuitive and easy to remember to me since it is
very similar to the way value level functions are defined (signature &
pattern matching defs). Here we are just defining a type level function
instead.

-harendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161113/209f131b/attachment.html>


More information about the ghc-devs mailing list