[Haskell] My brain just exploded

Simon Peyton-Jones simonpj at microsoft.com
Wed May 17 11:36:22 EDT 2006


[Redirecting to GHC users]

Yes, GHC insists that you use 'case' when unpacking data constructor
that bind existential type variables.
http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.
html#existential-quantification (look at 7.4.1.4.3)

It's not clear (to me) how to write the typing rule for pattern matching
in lets when existentials are involved.

Simon

| -----Original Message-----
| From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org]
On Behalf Of Dominic
| Steinitz
| Sent: 14 May 2006 09:03
| To: haskell at haskell.org
| Subject: [Haskell] My brain just exploded
| 
| What a great error message:
| 
| qcgadt.hs:115:7:
|     My brain just exploded.
|     I can't handle pattern bindings for existentially-quantified
constructors.
|     In the binding group
|         (Rep x) = uncompressRep s
|     In the definition of `uncompressRep':
|         uncompressRep (0 : 1 : 0 : s) = let (Rep x) = uncompressRep s
in Rep
| (RList x)
| Failed, modules loaded: none.
| 
| Here's the offending line:
| 
| uncompressRep (0:1:1:s) =
|    let (Rep x) = uncompressRep s in
|       Rep (RList x)
| 
| But this works:
| 
| uncompressRep (0:1:0:s) =
|    let x = uncompressRep s in
|        case x of
|           (Rep y) -> Rep (RList y)
| 
| Can someone explain this?
| 
| Thanks, Dominic.
| 
| 
| 
| _______________________________________________
| Haskell mailing list
| Haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell


More information about the Glasgow-haskell-users mailing list