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,862
    • Issues 4,862
    • 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
  • #19507
Closed
Open
Created Mar 09, 2021 by Edward Kmett@ekmett

Permit bundling pattern synonyms with type synonyms

Motivation

When mtl moved from v1 to v2, 'State' became a mere type synonym and we lost the 'State' data constructor.

Now we have pattern synonyms and could almost restore the appearance and teachability of the world before:

So I can export

module Control.Monad.Trans.State
  ( State
  , pattern State
  , StateT(..)
  ...
  ) where

but since I can't bundle the State pattern with the State type, a careful user who imports State(..) fails to get a way to construct/deconstruct one.

This sort of thing happens over and over again as folks refactor APIs. Whenever I do so, I inevitably get complaints from users who use explicit minimal imports, who then have to CPP around the issue or import the pattern explicitly, or give up on their carefully crafted narrow imports.

Proposal

I'd like to just be able to bundle pattern synonyms with type synonyms, not only with data types.

This has been just a low-key wart for a long time, but it doesn't seem like it should be too hard to just allow as it only affects the import/export syntax. It almost seems harder to explicitly block this and provide the current behavior.

Edited Mar 09, 2021 by Edward Kmett
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking