[Haskell-cafe] an idea for modifiyng data/newtype syntax: use `::=` instead of `=`

Alexey Muranov alexey.muranov at gmail.com
Wed Aug 19 08:09:29 UTC 2015


On 18 août 2015, at 08:16, Richard A. O'Keefe <ok at cs.otago.ac.nz> wrote:

> If you want to argue about the grammar of 'data' declarations,
> go right ahead.  I myself was a little confused by them at
> the beginning, because the declare a new type and some
> constructors, but do not declare 'data' in the sense that a
> DATA statement in BASIC or Fortran or the DATA DIVISION in
> COBOL does.  The word 'data' is so very far from conveying
> the idea "introduce a new type" that it's not funny.

Ok, then, just hypothetically (i do not want to argue about actually introducing it), how about

    type Name = String 
    type Date ::= Date Int Int Int 
    type Anniversary ::= Birthday Name Date | Wedding Name Name Date

instead of

    type Name = String 
    data Date = Date Int Int Int 
    data Anniversary = Birthday Name Date | Wedding Name Name Date

?

Alexey.


More information about the Haskell-Cafe mailing list