Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exactPrint fails with class type family #476

Open
skatayama opened this issue Aug 18, 2023 · 0 comments
Open

exactPrint fails with class type family #476

skatayama opened this issue Aug 18, 2023 · 0 comments

Comments

@skatayama
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant