{-# LANGUAGE EmptyDataDecls, TypeFamilies #-}
instance Foo Bar where
data Baz Bar
This source file can be parsed just fine, but attempting to exactPrint the resulting module throws an exception:
"{-# LANGUAGE EmptyDataDecls, TypeFamilies #-}\n\ninstance Foo Bar where\n data Baz Bar*** Exception: ExactP: InstDecl: InsGData is given too few srcInfoPoints
CallStack (from HasCallStack):
error, called at src/Language/Haskell/Exts/ExactPrint.hs:63:10 in haskell-src-exts-1.23.1-FvLIaTIGxmRVhU8jEdAAL:Language.Haskell.Exts.ExactPrint
It’s a bit suspicious that the parser produced an InsGData (instance GADT declaration) instead of an InsData, even without GADTs enabled. It appears from a cursory inspection of the source that the exact printing implementation for InsGData assumes that a where always needs to be printed, which is violated by the parser in this case but would make sense if an ambiguous empty data declaration is supposed to produce an InsData.
This source file can be parsed just fine, but attempting to
exactPrint
the resulting module throws an exception:It’s a bit suspicious that the parser produced an
InsGData
(instance GADT declaration) instead of anInsData
, even withoutGADTs
enabled. It appears from a cursory inspection of the source that the exact printing implementation forInsGData
assumes that awhere
always needs to be printed, which is violated by the parser in this case but would make sense if an ambiguous empty data declaration is supposed to produce anInsData
.