Implement hacky workaround for issue 89
parent
a237e591b2
commit
e9aacb27ff
|
@ -606,3 +606,8 @@ go l ((IRType, _a) : eqr) = go l eqr
|
|||
go l ((_, IRType) : eqr) = go l eqr
|
||||
go _ ((IRTypeError ps t1 t2, _) : _) = Left $ makeError ps t1 t2
|
||||
go _ ((_, IRTypeError ps t1 t2) : _) = Left $ makeError ps t1 t2
|
||||
|
||||
#test issue 89 - type-family-instance
|
||||
|
||||
type instance (XPure StageParse) = ()
|
||||
type Pair a = (a, a)
|
||||
|
|
|
@ -514,6 +514,20 @@ ppDecl d@(L loc decl) = case decl of
|
|||
Left ns -> docLines $ return <$> ns
|
||||
Right n -> return n
|
||||
layoutBriDoc briDoc
|
||||
InstD (TyFamInstD{}) -> do
|
||||
-- this is a (temporary (..)) workaround for "type instance" decls
|
||||
-- that do not round-trip through exactprint properly.
|
||||
let fixer s = case List.stripPrefix "type " s of
|
||||
Just rest | not ("instance" `isPrefixOf` rest) ->
|
||||
"type instance " ++ rest
|
||||
_ -> s
|
||||
str <- mAsk <&> \anns ->
|
||||
intercalate "\n" $ fmap fixer $ lines' $ ExactPrint.exactPrint d anns
|
||||
bd <- briDocMToPPM $ allocateNode $ BDFExternal (ExactPrint.mkAnnKey d)
|
||||
(foldedAnnKeys d)
|
||||
False
|
||||
(Text.pack str)
|
||||
layoutBriDoc bd
|
||||
_ -> briDocMToPPM (briDocByExactNoComment d) >>= layoutBriDoc
|
||||
|
||||
-- Prints the information associated with the module annotation
|
||||
|
|
Loading…
Reference in New Issue