help from the community?

Conor McBride ctm at cs.nott.ac.uk
Thu Feb 1 01:08:23 EST 2007


Hi

Ashley Yakeley wrote:
> Taral wrote:
>
> > I see nothing wrong with "case x of {}", with required braces. The
> > layout rule never generates empty braces.
>
> Also consider a simple "case x",

[..]

> This will be useful for GADTs:
>
>   data MyGADT a where
>     IntGADT :: MyGADT Int
>
>   never :: MyGADT Char -> t
>   never x = case x  -- no bottom needed

I like it, but I might like it even more if there was a little more noise
  (1) to distinguish this syntax from a lapse of concentration
  (2) to indicate that the construct is (morally) strict, well-defined 
because x is undefined;
       remember, case undefined { _ -> () } is ().

I don't like "case x of {}", because it's just another way of saying 
"undefined", ie "x might have cases but we're not going to handle any of 
them". If there was some total variant, "cover" of case whose coverage 
was enforced, I'd be happy with "cover x of {}".

How about "case ! x" ?

Or not

Conor



More information about the Haskell-prime mailing list