Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,868
    • Issues 4,868
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 458
    • Merge requests 458
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #919
Closed
Open
Created Oct 02, 2006 by Josef Svenningsson@josefsContributor

Cryptic type error message (should be syntax error)

It seems ghc allows a syntax for types which if beyond Haskell98 even without -fglasgow-exts. Consider the following program:

destroy :: (forall a. (a -> Maybe (b,a)) -> a -> c) -> [b] -> c
destroy g xs = g listpsi xs
  where listpsi :: [a] -> Maybe (a,[a])
        listpsi [] = Nothing
        listpsi (x:xs) = Just (x,xs)

It gives the following rather cryptic error message without -fglasgow-exts:

ConcatMap.hs:7:17:
    Couldn't match expected type `.' (a rigid variable)
           against inferred type `(->)'
      `.' is bound by the type signature for `destroy'
        at ConcatMap.hs:6:20
    Probable cause: `listpsi' is applied to too few arguments
    In the first argument of `g', namely `listpsi'
    In the expression: g listpsi xs

The fact that ghc interpreted `.' as a type variable baffeled me for a moment. I would expect ghc to report a syntax error since the type is not syntactically Haskell98.

Trac metadata
Trac field Value
Version 6.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking