#2935: "A lazy (~) pattern cannot bind existential type variables" happens for
non-existential GADTs
---------------------------------+------------------------------------------
    Reporter:  ganesh            |        Owner:                  
        Type:  bug               |       Status:  closed          
    Priority:  normal            |    Milestone:                  
   Component:  Compiler          |      Version:  6.10.1          
    Severity:  normal            |   Resolution:  wontfix         
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * status:  new => closed
  * difficulty:  => Unknown
  * resolution:  => wontfix

Comment:

 The error message is not good, but it's right to reject this program.
 More precisely, it'd definitely be right to reject this program:
 {{{
 bar :: a -> Foo a -> a
 bar x ~(Foo _) = fst x
 }}}
 Because I could call `bar 3 undefined`, and thereby crash.   Now in this
 case (a) the data type has only one constructor, (b) the type signature
 for `foo` ensures that every call will match `Foo`'s constraints.  So
 nothing would go wrong.  But it's a very special case. And I don't know
 how to translate it into System F (or more precisely Fc).

 So it's not easy.  So I propose to do nothing except perhaps make the
 error message mention GADTs too.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2935#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to