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,262
    • Issues 5,262
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 566
    • Merge requests 566
  • 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
  • #11351
Closed
Open
Issue created Jan 04, 2016 by Icelandjack@IcelandjackReporter

Scoped type variables in pattern synonyms

Unsure of pattern synonym scoping rules. I want to be able to refer to a type in the signature (assuming symbol from #11349):

symbol :: forall s. KnownSymbol s => String
symbol = symbolVal @s Proxy

-- Not in scope: type variable ‘s’
-- Not in scope: type variable ‘s’
pattern Symbol :: forall s. KnownSymbol s => String
pattern Symbol <- ((== symbol @s) -> True) where
         Symbol = symbol @s

Without TypeApplications:

-- • Could not deduce (KnownSymbol n0)
--     arising from a use of ‘symbolVal’
--   from the context: KnownSymbol s
--     bound by the type signature for pattern synonym ‘Symbol’:
--                String
pattern Symbol :: forall s. KnownSymbol s => String
pattern Symbol <- ((== symbolVal (Proxy :: Proxy s)) -> True)

but it (GHCi, version 8.1.20160102) says the type variable s is not in scope. Is this intentional?

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