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,859
    • Issues 4,859
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 454
    • Merge requests 454
  • 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
  • #19294
Closed
Open
Created Feb 01, 2021 by Krzysztof Gogolewski@monoidalDeveloper

Pattern synonym fields should not allow type synonyms

Currently, a type synonym can be used to define fields of a pattern synonym:

{-# LANGUAGE PatternSynonyms #-}
type T = Int -> Int
pattern P :: T
pattern P x = x

I think this should be disallowed, just like we disallow

{-# LANGUAGE GADTs #-}
type T = Int -> X
data X where
  MkX :: T

The arrows -> in a pattern synonym type and in a GADT constructor are not functions; they are a syntactic form used to delimit fields. The same holds for the two => arrows that can appear in a pattern synonym type.

Another possible testcase is pattern P :: (->) Int Int (compare #17211 (closed))

Edited May 30, 2021 by Krzysztof Gogolewski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking