Skip to content

exactPrint fails with class type family #476

Open
@skatayama

Description

@skatayama

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions