Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,332
    • Issues 4,332
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 370
    • Merge Requests 370
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2275

Closed
Open
Opened May 09, 2008 by guest@trac-guest

Poor indication of type error location

Using # OPTIONS_GHC -XArrows -fno-monomorphism-restriction #, and Yampa Starting from line 32, my program contains:

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

The type error reports:

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'

Indicating that the bug is something to do with line 34. The actual bug is that the last line of the paste should read:

    v0 = (pFinal .-. p0) ^/ 2
Edited Mar 09, 2019 by Ian Lynagh <igloo@earth.li>
Assignee
Assign to
6.10 branch
Milestone
6.10 branch
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2275