Skip to content

Record fields not defined with pattern synonym in ghci

Another thing discovered while in the air: When you define pattern synonyms with record syntax, the fields aren't defined in GHCI:

$ ghci -ignore-dot-ghci -XPatternSynonyms
GHCi, version 8.1.20160419: http://www.haskell.org/ghc/  :? for help
Prelude> pattern Point {x, y} = (x, y)
Prelude> :t x

<interactive>:1:1: error: Variable not in scope: x
Prelude> 

Works fine when imported from a file.

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information