module Language.Symantic.Typing.Show where
import qualified Data.Text.Lazy as TL
-import qualified Data.Text.Lazy.Builder as TLB
-import qualified Language.Symantic.Document as D
+import qualified Language.Symantic.Document.Term as Doc
import Language.Symantic.Grammar
import Language.Symantic.Typing.Type
import Language.Symantic.Typing.Module
import Language.Symantic.Typing.Document
+stringDocTerm :: Doc.Term -> String
+stringDocTerm =
+ TL.unpack .
+ Doc.textTerm .
+ Doc.withColorable False .
+ Doc.withDecorable False
+
showType :: Config_Doc_Type -> Type src vs t -> String
-showType conf ty = TL.unpack $ TLB.toLazyText $ D.plain $ docType conf 0 ty
+showType conf ty = stringDocTerm $ docType conf 0 ty
showTypeS :: Config_Doc_Type -> Precedence -> Type src vs t -> ShowS
-showTypeS conf pr ty = showString $ TL.unpack (TLB.toLazyText $ D.plain $ docType conf pr ty)
+showTypeS conf pr ty = showString $ stringDocTerm $ docType conf pr ty
showTypes :: Config_Doc_Type -> Types src vs ts -> String
-showTypes conf tys = TL.unpack (TLB.toLazyText $ D.plain $ docTypes conf tys)
+showTypes conf tys = stringDocTerm $ docTypes conf tys
showTypesS :: Config_Doc_Type -> Types src vs ts -> ShowS
-showTypesS conf tys = showString $ TL.unpack (TLB.toLazyText $ D.plain $ docTypes conf tys)
+showTypesS conf tys = showString $ stringDocTerm $ docTypes conf tys
instance NameTyOf c => Show (Const src c) where
- showsPrec _p = showString . TL.unpack . TLB.toLazyText . D.plain . docConst mempty
+ showsPrec _p = showString . stringDocTerm . docConst mempty
instance Source src => Show (Type src vs t) where
showsPrec = showTypeS config_Doc_Type