Changes between Version 18 and Version 19 of PolymorphicComponents


Ignore:
Timestamp:
Apr 4, 2007 8:47:07 PM (8 years ago)
Author:
diatchki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PolymorphicComponents

    v18 v19  
    6161 1. Introduce a new ''special identifier'', '''forall'''.  This identifier has a special interpretation in types and type schemes (i.e., it is ''not'' a type variable).
    6262    However, '''forall''' can still be used as an ordinary variable in expressions.
    63  2. Syntax for writing type schemes
     63 2. Syntax for writing type schemes:
    6464{{{
    6565scheme   -> 'forall' tvar_1 .. tyvar_n '.' opt_ctxt type    (n > 0)
     
    7575          |
    7676}}}
    77  3. Syntax for algebraic datatype (Section 4.2.1)
    78 Change ''type'',''atype'',''btype'' to ''scheme'', ''ascheme'', ''bscheme' respectively.
     77 3. Syntax for '''data''' and '''newtype''' declarations
     78 Change ''type'',''atype'',''btype'' to ''scheme'', ''ascheme'', ''bscheme'' respectively.
    7979{{{
    80 constr   -> con [!] ascheme_1 ... [!] ascheme_k          (arity con = k, k>=0)
    81           | (bscheme | ! ascheme) conop (bscheme | ! ascheme)   (infix conop)
    82           | con { fielddecl1 , ... , fielddecln }       (n>=0)
    83 fielddecl-> vars :: (scheme | ! ascheme)
     80-- Section 4.2.1
     81constr   -> con acon_filed_1 ... acon_field_k       (arity con = k, k>=0)
     82          | bcon_field conop bcon_field             (infix conop)
     83          | con { fielddecl1 , ... , fielddecln }   (n>=0)
     84fielddecl-> vars :: con_field
     85
     86con_field  -> ! ascheme | scheme
     87acon_filed -> ! ascheme | ascheme
     88bcon_filed -> ! ascheme | bscheme
     89
     90-- Section 4.2.3
     91newconstr -> con ascheme
     92          | con { var :: scheme }
    8493}}}
    85 
    86 
    87    1. 4.2.1 - syntax in "Algebreic Datatype Declarations", add ''forall'' to various bits.
    88    1. 4.2.3 - syntax in "Datatype Renaming" ''newtype'' declarations
     94 NOTE: The grammar in the Haskell 98 report contains a minor bug that seems
     95 to allow erroneous data declarations like the following:
     96{{{
     97data T = C !
     98}}}
     99 For this reason I introduced the ''con_field'' productions.
    89100 1. lots of english text in algebreic datatype declartions
    90101 1. english text in Labelled fields - give an example of fields with polymorphic types, or do this in section 3?