Skip to content

Pattern synonyms and record selectors

Consider this

{-# LANGUAGE PatternSynonyms, ExistentialQuantification #-}
module ExQuant where

data Showable = forall a . Show a => Showable { fs :: a }

pattern Nasty{fn} = Showable fn

qux1 = fs (Showable True)
qux2 = fn (Showable True)

I have discovered that in qux2, the use of fn is a HsVar, not a HsRecFld as it should be. And the occurrence of fs in qux1 is indeed a HsFld.

I'm not sure of the consequences, but it looks inconsistent and wrong.

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information