exactPrint fails with class type family
skatayama opened this issue · 0 comments
skatayama commented
The following code parseWithComments and prettyPrints successfully, but fails to exactPrint:
exactPrintFails.hs (code to be parsed and printed):
{-# LANGUAGE TypeFamilies #-}
class HasFoo a where
type Foo a
getFoo :: a -> Foo a
what I tried:
$ ghci-9.0.2 -package haskell-src-exts-1.23.1
(snip)
ghci> :m Language.Haskell.Exts
ghci> contents <- readFile "exactPrintFails.hs"
ghci> let ParseOk (mod,comments) = parseWithComments defaultParseMode{extensions = [EnableExtension TypeFamilies]} contents :: ParseResult (Module SrcSpanInfo,[Comment])
ghci> prettyPrint mod
"{-# LANGUAGE TypeFamilies #-}\n\nclass HasFoo a where\n type Foo a\n \n getFoo :: a -> Foo a"
ghci> exactPrint mod comments
"{-# LANGUAGE TypeFamilies #-}\n\nclass HasFoo a where\n *** Exception: ExactP: ClassDecl: ClsTyFam 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-2620066d24fc7890d6763a729bbef1e1536104df804f5005d54558c967f02e70:Language.Haskell.Exts.ExactPrint
ghci>
Thank you.