Constructors in GHC

Lauri Alanko la@iki.fi
Wed, 11 Dec 2002 14:35:17 +0200


On Wed, Dec 11, 2002 at 11:40:39AM -0000, Simon Peyton-Jones wrote:
> We could make this more consistent in two ways.  Alternative (A): One
> way would be to make it clearer that $wMkT was the real constructor:
> 
> 	data T = $wMkT Int Int
> 	MkT p = case p of (x,y) -> $wMkT x y
> 	f x y = $wMkT x y
> 	g t = case t of $wMkT x y -> x
> 
> This is consistent, but it makes External Core a bit funny.  (The real
> constructors are always $w things.)  

Speaking as a common user who hasn't used External Core for anything,
this one looks much more attractive to me. Consistency and predictable
typing is important, and it's ok for things to look funny because,
after all, funny things _are_ going on when special optimizations are
applied.


Lauri Alanko
la@iki.fi