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,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • 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
  • #20083
Closed
Open
Created Jul 05, 2021 by Krzysztof Gogolewski@monoidalDeveloper

Linear types and -fdefer-type-errors

Linear types combined with -fdefer-type-errors show a poor error message.

ghci> :set -XLinearTypes
ghci> ap :: (a -> b) -> a %m -> b; ap f x = f x

<interactive>:2:35: error:
    • Couldn't match type ‘m’ with ‘'Many’
        arising from multiplicity of ‘x’
      ‘m’ is a rigid type variable bound by
        the type signature for:
          ap :: forall a b (m :: GHC.Types.Multiplicity).
                (a -> b) -> a %m -> b
        at <interactive>:2:1-27
    • In an equation for ‘ap’: ap f x = f x
    • Relevant bindings include
        ap :: (a -> b) -> a %m -> b (bound at <interactive>:2:30)
ghci> :set -fdefer-type-errors
ghci> ap :: (a -> b) -> a %m -> b; ap f x = f x

<interactive>:4:30: error:
    Multiplicity coercions are currently not supported (see GHC #19517)

<interactive>:4:30: error:
    Multiplicity coercions are currently not supported (see GHC #19517)

The error message is technically correct, but -fdefer-type-errors downgrades the type mismatch to a warning. The warning is not shown, while it contains important information.

Until #19517 is done, when -fdefer-type-errors is on, we should compile multiplicity coercions to runtime errors and convert the error to a warning.

Also make the message more user-friendly.

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