Pattern bindings for existential constructors
问题 While writing Haskell as a programmer that had exposure to Lisp before, something odd came to my attention, which I failed to understand. This compiles fine: {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ExistentialQuantification #-} data Foo = forall a. Show a => Foo { getFoo :: a } showfoo :: Foo -> String showfoo Foo{getFoo} = do show getFoo whereas this fails: {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ExistentialQuantification #-} data Foo = forall a. Show a => Foo { getFoo :: a }