[GHC] #2275: Poor indication of type error location

GHC trac at galois.com
Fri May 9 04:43:36 EDT 2008


#2275: Poor indication of type error location
----------------------------------------+-----------------------------------
    Reporter:  guest                    |        Owner:         
        Type:  bug                      |       Status:  new    
    Priority:  normal                   |    Milestone:         
   Component:  Compiler (Type checker)  |      Version:  6.8.2  
    Severity:  normal                   |   Resolution:         
    Keywords:                           |     Testcase:         
Architecture:  Unknown                  |           Os:  Unknown
----------------------------------------+-----------------------------------
Comment (by guest):

 Sorry, here's the code again:
 {{{

 fireworkSF :: Point2 GL.GLdouble -> Point2 GL.GLdouble -> Object
 fireworkSF p0 pFinal = proc _ -> do
   rec
     position <- (p0 .+^) ^<< integral -< v0
     let shouldExplode = position == pFinal
     let killReq = if shouldExplode then Event () else noEvent
     let spawnReq = if shouldExplode
                      then Event (Explode pFinal)
                      else noEvent
   returnA -< ObjectOutput {oState = FireworkState position
                           ,oKillReq = killReq
                           ,oSpawnReq = spawnReq}
   where
     v0 = (pFinal ^-^ p0) ^/ 2
 }}}

 And the error:
 {{{
 Firework.hs:32:0:
     Couldn't match expected type `Point2 GL.GLdouble'
            against inferred type `Vector2 GL.GLdouble'
     When using functional dependencies to combine
       AffineSpace (Point2 a) (Vector2 a) a,
         arising from the instance declaration at <no location info>
       AffineSpace (Point2 GL.GLdouble) (Point2 GL.GLdouble) a,
         arising from a use of `.+^' at Firework.hs:34:16-23
     When generalising the type(s) for `fireworkSF'
 }}}

 and the correct line:
 {{{     v0 = (pFinal .-. p0) ^/ }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2275#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list