Skip to content
GitLab
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 5,265
    • Issues 5,265
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 568
    • Merge requests 568
  • 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 CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20330
Closed
Open
Issue created Sep 03, 2021 by sheaf@sheafMaintainer

Representation-polymorphism checks for primops check too many arguments

The following program is currently rejected:

blart :: forall (r :: RuntimeRep) (a :: TYPE r). a -> a
blart = raise# 5
error:
    Cannot use function with representation-polymorphic arguments:
      raise# :: Integer -> a -> a
    (Note that representation-polymorphic primops,
    such as 'coerce' and unboxed tuples, are eta-expanded
    internally because they must occur fully saturated.
    Use -fprint-typechecker-elaboration to display the full expression.)
    Representation-polymorphic arguments: a :: TYPE r
   |
13 | blart = raise# 5
   |         ^^^^^^

The problem is that the code that checks for disallowed representation-polymorphism when instantiating primops, which is supposed to catch cases like:

foo :: forall (r :: RuntimeRep) (a :: TYPE r) b. a -> b
foo = unsafeCoerce#

ends up checking all the function arguments in the return type, even past the primop's arity.

I will be fixing this as part of !6164 (closed).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking