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

MigMit miguelimo38 at yandex.ru
Sat Aug 8 20:43:39 UTC 2015

> One could discuss if "newtype" is really needed when we have "data" plus strictness annotations (personally I'm a bit unsure what the common use case for "case" is where they differ and what one might consider more natural).

Prelude> newtype A = A Int deriving Show
Prelude> data B = B !Int deriving Show
Prelude> let x = case x of A n -> A 1 in x
A 1
Prelude> let y = case y of B n -> B 1 in y
*** Exception: <<loop>>

> P.S.: If you think this part of Haskell is a bit hard to read and confusing, I seriously propose a week or two in C++'s wonderful meta-programming world with templates... ;-)

Can't agree more

More information about the Haskell-Cafe mailing list