#3409: type variable out of scope in worker/wrapper transformation
---------------------------------+------------------------------------------
    Reporter:  judahj            |        Owner:  chak            
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:                  
   Component:  Compiler          |      Version:  6.10.3          
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * difficulty:  => Unknown

Comment:

 No, it's quite different.  Here is a much smaller example:
 {{{
 data T = forall a. T a (Funny a)
 type Funny a = Bool

 f :: T -> Bool
 f (T x n) = n
 }}}
 This kills Lint because the type of the RHS is `(Funny a)` where `a` is
 existentially quantified.

 For future reference, I boiled down the original program to this simpler
 form:
 {{{
 newtype Size s = Size Int

 data ArrayS d e = ArrayS d e

 data Array1 e = forall s . Array1 (Size s) (ArrayS (Size s) e)
 -- Array1 :: forall e s. Size s -> ArrayS (Size s) e -> Array1 e

 copy ::  Int -> Array1 a -> Array1 a
 copy _ (Array1 s a) = Array1 s $ (ArrayS s (bang a))
   -- Array1 s :: ArrayS (Size s) a -> Array1 a

   -- s :: Size s
   -- a :: ArrayS (Size s) a
   -- ArrayS :: Size s -> a -> ArrayS (Size s) a
   -- i :: AccessIx (ArrayS (Size s) a) = Ix s
   -- bang a :: AccessResult (ArrayS (Size s) a) = a

   -- ArrayS s (bang a) :: ArrayS (Size s) (AccessResult (ArrayS (Size s)
 a))

 class Access a where
     type AccessResult a
     bang :: a -> AccessResult a

 instance Access (ArrayS d a) where
     type AccessResult (ArrayS d a) = a
 }}}
 Just recording this for now.  There's nothing actually wrong, but Lint
 should not bleat.  I'll have to think about what the best fix is.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3409#comment:3>
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