Changes between Version 4 and Version 5 of EmptyDataDecls


Ignore:
Timestamp:
Oct 23, 2006 7:12:55 PM (9 years ago)
Author:
nhn@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EmptyDataDecls

    v4 v5  
    11= Empty data declarations =
    22[[PageOutline]]
    3  
     3
    44'''Ticket:''' #25
    5  
     5
    66== Brief Explanation ==
    7  
     7
    88The proposal is to allow empty `data` declarations, i.e. data types without any
    99constructors. Syntactically, it is basically just a matter of making the
     
    1212whose only element is bottom. Examples (assuming
    1313[wiki:InfixTypeConstructors Infix Type Constructors] is adopted):
    14  
     14
    1515{{{
    1616data S
     
    2222data (a :**: b) c
    2323}}}
    24  
     24
    2525[wiki:KindInference Kind inference] will of course be carried out for types constructors
    2626introduced by empty declarations just as for any  other type constructors according to
    27 whatever rules are adopted. Unless there are further constraints the kinds of the
     27whatever rules are adopted. Unless there are further constraints, the kinds of the
    2828constructors above would be
    2929{{{
     
    3333(:**:) :: * -> * -> * -> *
    3434}}}
    35  
     35
    3636If [wiki:KindAnnotations kind annotations] are adopted, they should obviously also apply
    3737to empty declarations. They would possibly be a little more important for empty declarations,
     
    4343annotations then never would be needed, unless it is decided that kind annotations still would
    4444be good documentation.
    45                                                                                
     45
    4646Note that contexts of course also would be allowed, but, as there are no data constructors, their
    4747only impact would be on the inferred kind.
    48                                                                                
     48
    4949The only real issue is whether or not to allow the optional `deriving` clause after an empty declaration,
    5050and, if not, on what stage to rule them out. Clearly, as there are no data constructors over which to
     
    5454gives a more regular syntax and better error messages than ruling out deriving for empty declarations
    5555syntactically. But the point is that there is a choice.
    56                                                                                
     56
    5757== References ==
    5858 * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#nullary-types] GHC documentation.
     
    6060 * [[TicketQuery(description~=KindAnnotations)]]
    6161 * [[TicketQuery(description~=InfixTypeConstructors)]]
    62                                                                                
     62
    6363== Pros ==
    6464 * A simple and natural generalisation of data declarations, seemingly without any hidden complications.
    65                                                                                
     65
    6666== Cons ==