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,865
    • Issues 4,865
    • 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
  • #20184
Closed
Open
Created Jul 29, 2021 by Krzysztof Gogolewski@monoidalDeveloper

Linear types and pattern synonyms

Linear types cannot be used in pattern synonyms. This ticket is a placeholder to track this as a feature request. If you're interested, please speak up.

As a first step, this requires design. For example, we could support

id :: a %1 -> a
id x = x

nonlinear :: a -> a
nonlinear x = x

f1 (id -> x) = h x
f2 (nonlinear -> x) = h x
f3 (Unrestricted x) = h x

The function f1 is linear iff h is; the function f2 is never linear; the function f3 is always linear. Perhaps this could be done by annotating the result of a pattern synonym:

pattern P1 :: a %One -> a %One
pattern P2 :: a %Many -> a %Many
pattern P3 :: a %One -> a %Many

but I haven't checked the details. This also requires thinking about the type of matchers in Core.

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