parser: add output to a given IO.Handle
authorJulien Moutinho <julm@autogeree.net>
Mon, 24 Jun 2019 20:10:18 +0000 (20:10 +0000)
committerJulien Moutinho <julm@autogeree.net>
Mon, 24 Jun 2019 20:10:18 +0000 (20:10 +0000)
Symantic/CLI/Parser.hs

index a8209a866c9c421907399fd6884818184e6d3ea3..f2d8bbe1da74c860e706adee7cef50172afae350 100644 (file)
@@ -274,15 +274,12 @@ instance Outputable (Doc.AnsiText (Doc.Plain TLB.Builder)) where
                TLB.toLazyText .
                Doc.runPlain .
                Doc.runAnsiText
-
-{-
-instance Outputable (Doc.Reorg Doc.Term) where
-       output = TL.hPutStrLn IO.stdout . Doc.textTerm
-instance Outputable (Doc.Reorg DocIO.TermIO) where
-       output = DocIO.runTermIO IO.stdout
-instance Outputable (IO.Handle, (Doc.Reorg DocIO.TermIO)) where
-       output = uncurry DocIO.runTermIO
--}
+instance Outputable (IO.Handle, Doc.AnsiText (Doc.Plain TLB.Builder)) where
+       output (h,d) =
+               TL.hPutStr h $
+               TLB.toLazyText $
+               Doc.runPlain $
+               Doc.runAnsiText d
 
 -- * Class 'IOType'
 -- | Like a MIME type but for input/output of a CLI.
@@ -300,11 +297,7 @@ instance IOType String
 instance IOType Text.Text
 instance IOType TL.Text
 instance IOType (Doc.AnsiText (Doc.Plain TLB.Builder))
-{-
-instance IOType (Doc.Reorg Doc.Term) where
-instance IOType (Doc.Reorg DocIO.TermIO) where
-instance IOType (IO.Handle, Doc.Reorg DocIO.TermIO)
--}
+instance IOType (IO.Handle, Doc.AnsiText (Doc.Plain TLB.Builder))
 
 -- * Class 'FromSegment'
 class FromSegment a where