case-identity

Simon Peyton-Jones simonpj@microsoft.com
Wed, 23 Jul 2003 14:06:16 +0100


In Core, the list of alternatives is always exhaustive.  This invariant
is not
documented in CoreSyn.lhs, but it should be.  I'll do that today.

| -----Original Message-----
| From: glasgow-haskell-users-admin@haskell.org
[mailto:glasgow-haskell-users-admin@haskell.org]
| On Behalf Of David Sabel
| Sent: 23 July 2003 13:14
| To: glasgow-haskell-users@haskell.org
| Subject: case-identity
|=20
| Hi,
|=20
| the case-identity transformation is
|=20
| case e of
|  pat1 -> pat1         =3D=3D=3D>   e
|  ...
|  patn -> patn
|=20
| It's performed in SimplUtils.mkCase1.
|=20
| My (very special) question is: How do you ensure, that
|  there's a case-alternative for every constructor of the type of e?
|=20
| Otherwise you could transform
|=20
| case e of {True -> True} =3D=3D=3D> True, if e is of type Bool,
|=20
| but that't not correct if e is False.
|=20
| Maybe you add a default-alternative DEFAULT -> error ... ?
|=20
| Thanks,
|=20
|  David
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users