content: -- File generated by the BNF Converter (bnfc 2.9.4.1).
  
  {-# LANGUAGE CPP #-}
  {-# LANGUAGE FlexibleInstances #-}
  {-# LANGUAGE LambdaCase #-}
  #if __GLASGOW_HASKELL__ <= 708
  {-# LANGUAGE OverlappingInstances #-}
  #endif
  
  -- | Pretty-printer for Fort.
  
  module Fort.Print where
  
  import Prelude
    ( ($), (.)
    , Bool(..), (==), (<)
    , Int, Integer, Double, (+), (-), (*)
    , String, (++)
    , ShowS, showChar, showString
    , all, elem, foldr, id, map, null, replicate, shows, span
    )
  import Data.Char ( Char, isSpace )
  import qualified Fort.Abs
  import qualified Data.Text
  
  -- | The top-level printing method.
  
  printTree :: Print a => a -> String
  printTree = render . prt 0
  
  type Doc = [ShowS] -> [ShowS]
  
  doc :: ShowS -> Doc
  doc = (:)
  
  render :: Doc -> String
  render d = rend 0 False (map ($ "") $ d []) ""
    where
    rend
      :: Int        -- ^ Indentation level.
      -> Bool       -- ^ Pending indentation to be output before next character?
      -> [String]
      -> ShowS
    rend i p = \case
        "["      :ts -> char '[' . rend i False ts
        "("      :ts -> char '(' . rend i False ts
        "{"      :ts -> onNewLine i     p . showChar   '{'  . new (i+1) ts
        "}" : ";":ts -> onNewLine (i-1) p . showString "};" . new (i-1) ts
        "}"      :ts -> onNewLine (i-1) p . showChar   '}'  . new (i-1) ts
        [";"]        -> char ';'
        ";"      :ts -> char ';' . new i ts
        t  : ts@(s:_) | closingOrPunctuation s
                     -> pending . showString t . rend i False ts
        t        :ts -> pending . space t      . rend i False ts
        []           -> id
      where
      -- Output character after pending indentation.
      char :: Char -> ShowS
      char c = pending . showChar c
  
      -- Output pending indentation.
      pending :: ShowS
      pending = if p then indent i else id
  
    -- Indentation (spaces) for given indentation level.
    indent :: Int -> ShowS
    indent i = replicateS (2*i) (showChar ' ')
  
    -- Continue rendering in new line with new indentation.
    new :: Int -> [String] -> ShowS
    new j ts = showChar '\n' . rend j True ts
  
    -- Make sure we are on a fresh line.
    onNewLine :: Int -> Bool -> ShowS
    onNewLine i p = (if p then id else showChar '\n') . indent i
  
    -- Separate given string from following text by a space (if needed).
    space :: String -> ShowS
    space t s =
      case (all isSpace t', null spc, null rest) of
        (True , _   , True ) -> []              -- remove trailing space
        (False, _   , True ) -> t'              -- remove trailing space
        (False, True, False) -> t' ++ ' ' : s   -- add space if none
        _                    -> t' ++ s
      where
        t'          = showString t []
        (spc, rest) = span isSpace s
  
    closingOrPunctuation :: String -> Bool
    closingOrPunctuation [c] = c `elem` closerOrPunct
    closingOrPunctuation _   = False
  
    closerOrPunct :: String
    closerOrPunct = ")],;"
  
  parenth :: Doc -> Doc
  parenth ss = ss
  
  concatS :: [ShowS] -> ShowS
  concatS = foldr (.) id
  
  concatD :: [Doc] -> Doc
  concatD = foldr (.) id
  
  replicateS :: Int -> ShowS -> ShowS
  replicateS n f = concatS (replicate n f)
  
  -- | The printer class does the job.
  
  class Print a where
    prt :: Int -> a -> Doc
  
  instance {-# OVERLAPPABLE #-} Print a => Print [a] where
    prt i = concatD . map (prt i)
  
  instance Print Char where
    prt _ c = doc (showChar '\'' . mkEsc '\'' c . showChar '\'')
  
  instance Print String where
    prt _ = printString
  
  printString :: String -> Doc
  printString s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"')
  
  mkEsc :: Char -> Char -> ShowS
  mkEsc q = \case
    s | s == q -> showChar '\\' . showChar s
    '\\' -> showString "\\\\"
    '\n' -> showString "\\n"
    '\t' -> showString "\\t"
    s -> showChar s
  
  prPrec :: Int -> Int -> Doc -> Doc
  prPrec i j = if j < i then parenth else id
  
  instance Print Integer where
    prt _ x = doc (shows x)
  
  instance Print Double where
    prt _ x = doc (shows x)
  
  instance Print Fort.Abs.ADoubleTok where
    prt _ (Fort.Abs.ADoubleTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.AStringTok where
    prt _ (Fort.Abs.AStringTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.BinTok where
    prt _ (Fort.Abs.BinTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.CharTok where
    prt _ (Fort.Abs.CharTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.DecTok where
    prt _ (Fort.Abs.DecTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.HexTok where
    prt _ (Fort.Abs.HexTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.InfixOpTok where
    prt _ (Fort.Abs.InfixOpTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.IntTok where
    prt _ (Fort.Abs.IntTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.LIdentTok where
    prt _ (Fort.Abs.LIdentTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.OctTok where
    prt _ (Fort.Abs.OctTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.PrefixOpTok where
    prt _ (Fort.Abs.PrefixOpTok i) = doc $ showString (Data.Text.unpack i)
  instance Print Fort.Abs.UIdentTok where
    prt _ (Fort.Abs.UIdentTok i) = doc $ showString (Data.Text.unpack i)
  instance Print [Fort.Abs.Binding' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, prt 0 xs]
  
  instance Print [Fort.Abs.Exp' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]
  
  instance Print [Fort.Abs.FieldDecl' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]
  
  instance Print [Fort.Abs.LIdent' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemCaseAlt' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemExp' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemExpDecl' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemFieldDecl' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemIfBranch' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemStmt' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemTField' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.LayoutElemTSum' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print [Fort.Abs.Size' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]
  
  instance Print [Fort.Abs.TupleElemExp' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]
  
  instance Print [Fort.Abs.TupleElemPat' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]
  
  instance Print [Fort.Abs.TupleElemType' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ","), prt 0 xs]
  
  instance Print [Fort.Abs.Decl' a] where
    prt _ [] = concatD []
    prt _ [x] = concatD [prt 0 x]
    prt _ (x:xs) = concatD [prt 0 x, doc (showString ";"), prt 0 xs]
  
  instance Print (Fort.Abs.Module' a) where
    prt i = \case
      Fort.Abs.Module _ decls -> prPrec i 0 (concatD [prt 0 decls])
  
  instance Print (Fort.Abs.TupleElemExp' a) where
    prt i = \case
      Fort.Abs.TupleElemExp _ exp -> prPrec i 0 (concatD [prt 0 exp])
  
  instance Print (Fort.Abs.TupleElemPat' a) where
    prt i = \case
      Fort.Abs.TupleElemPat _ pat -> prPrec i 0 (concatD [prt 0 pat])
  
  instance Print (Fort.Abs.TupleElemType' a) where
    prt i = \case
      Fort.Abs.TupleElemType _ type_ -> prPrec i 0 (concatD [prt 0 type_])
  
  instance Print (Fort.Abs.LayoutElemTField' a) where
    prt i = \case
      Fort.Abs.LayoutElemTField _ tfield -> prPrec i 0 (concatD [prt 0 tfield])
  
  instance Print (Fort.Abs.LayoutElemTSum' a) where
    prt i = \case
      Fort.Abs.LayoutElemTSum _ tsum -> prPrec i 0 (concatD [prt 0 tsum])
  
  instance Print (Fort.Abs.LayoutElemExp' a) where
    prt i = \case
      Fort.Abs.LayoutElemExp _ exp -> prPrec i 0 (concatD [prt 0 exp])
  
  instance Print (Fort.Abs.LayoutElemStmt' a) where
    prt i = \case
      Fort.Abs.LayoutElemStmt _ stmt -> prPrec i 0 (concatD [prt 0 stmt])
  
  instance Print (Fort.Abs.LayoutElemIfBranch' a) where
    prt i = \case
      Fort.Abs.LayoutElemIfBranch _ ifbranch -> prPrec i 0 (concatD [prt 0 ifbranch])
  
  instance Print (Fort.Abs.LayoutElemCaseAlt' a) where
    prt i = \case
      Fort.Abs.LayoutElemCaseAlt _ casealt -> prPrec i 0 (concatD [prt 0 casealt])
  
  instance Print (Fort.Abs.LayoutElemFieldDecl' a) where
    prt i = \case
      Fort.Abs.LayoutElemFieldDecl _ fielddecl -> prPrec i 0 (concatD [prt 0 fielddecl])
  
  instance Print (Fort.Abs.LayoutElemExpDecl' a) where
    prt i = \case
      Fort.Abs.LayoutElemExpDecl _ expdecl -> prPrec i 0 (concatD [prt 0 expdecl])
  
  instance Print (Fort.Abs.ADouble' a) where
    prt i = \case
      Fort.Abs.ADouble _ adoubletok -> prPrec i 0 (concatD [prt 0 adoubletok])
  
  instance Print (Fort.Abs.AString' a) where
    prt i = \case
      Fort.Abs.AString _ astringtok -> prPrec i 0 (concatD [prt 0 astringtok])
  
  instance Print (Fort.Abs.AltPat' a) where
    prt i = \case
      Fort.Abs.PCon _ uident pat -> prPrec i 0 (concatD [prt 0 uident, prt 0 pat])
      Fort.Abs.PDefault _ lident -> prPrec i 0 (concatD [prt 0 lident])
      Fort.Abs.PEnum _ uident -> prPrec i 0 (concatD [prt 0 uident])
      Fort.Abs.PScalar _ scalar -> prPrec i 0 (concatD [prt 0 scalar])
  
  instance Print (Fort.Abs.Binding' a) where
    prt i = \case
      Fort.Abs.Delayed _ lident -> prPrec i 0 (concatD [doc (showString "~"), prt 0 lident])
      Fort.Abs.Immediate _ pat -> prPrec i 0 (concatD [prt 0 pat])
  
  instance Print (Fort.Abs.CaseAlt' a) where
    prt i = \case
      Fort.Abs.CaseAlt _ altpat exp -> prPrec i 0 (concatD [prt 0 altpat, doc (showString "->"), prt 0 exp])
  
  instance Print (Fort.Abs.Decl' a) where
    prt i = \case
      Fort.Abs.ExpDecl _ expdecl -> prPrec i 0 (concatD [prt 0 expdecl])
      Fort.Abs.ExportDecl _ astring quallident type_ -> prPrec i 0 (concatD [doc (showString "export"), prt 0 astring, doc (showString "="), prt 0 quallident, doc (showString "`"), prt 0 type_, doc (showString "`")])
      Fort.Abs.InfixDecl _ infixop infixinfo -> prPrec i 0 (concatD [doc (showString "operator"), prt 0 infixop, doc (showString "="), prt 0 infixinfo])
      Fort.Abs.PrefixDecl _ prefixop quallident -> prPrec i 0 (concatD [doc (showString "operator"), prt 0 prefixop, doc (showString "="), prt 0 quallident])
      Fort.Abs.QualDecl _ uident astring -> prPrec i 0 (concatD [doc (showString "qualifier"), prt 0 uident, doc (showString "="), prt 0 astring])
      Fort.Abs.TypeDecl _ uident type_ -> prPrec i 0 (concatD [doc (showString "type"), prt 0 uident, doc (showString "="), prt 0 type_])
  
  instance Print (Fort.Abs.Exp' a) where
    prt i = \case
      Fort.Abs.Where _ exp layoutelemexpdecls -> prPrec i 0 (concatD [prt 1 exp, doc (showString "where"), doc (showString "{"), prt 0 layoutelemexpdecls, doc (showString "}")])
      Fort.Abs.Lam _ bindings exp -> prPrec i 1 (concatD [doc (showString "\\"), prt 0 bindings, doc (showString "->"), prt 1 exp])
      Fort.Abs.Typed _ exp type_ -> prPrec i 2 (concatD [prt 2 exp, doc (showString ":"), doc (showString "`"), prt 0 type_, doc (showString "`")])
      Fort.Abs.With _ exp layoutelemfielddecls -> prPrec i 3 (concatD [prt 3 exp, doc (showString "with"), doc (showString "{"), prt 0 layoutelemfielddecls, doc (showString "}")])
      Fort.Abs.InfixOper _ exp1 infixop exp2 -> prPrec i 4 (concatD [prt 4 exp1, prt 0 infixop, prt 1 exp2])
      Fort.Abs.App _ exp1 exp2 -> prPrec i 5 (concatD [prt 5 exp1, prt 6 exp2])
      Fort.Abs.PrefixOper _ prefixop exp -> prPrec i 6 (concatD [prt 0 prefixop, prt 7 exp])
      Fort.Abs.Array _ exps -> prPrec i 7 (concatD [doc (showString "["), prt 0 exps, doc (showString "]")])
      Fort.Abs.Case _ exp layoutelemcasealts -> prPrec i 7 (concatD [doc (showString "case"), prt 0 exp, doc (showString "of"), doc (showString "{"), prt 0 layoutelemcasealts, doc (showString "}")])
      Fort.Abs.Con _ uident -> prPrec i 7 (concatD [prt 0 uident])
      Fort.Abs.Do _ layoutelemstmts -> prPrec i 7 (concatD [doc (showString "do"), doc (showString "{"), prt 0 layoutelemstmts, doc (showString "}")])
      Fort.Abs.EType _ type_ -> prPrec i 7 (concatD [doc (showString "`"), prt 0 type_, doc (showString "`")])
      Fort.Abs.Extern _ astring type_ -> prPrec i 7 (concatD [doc (showString "extern"), prt 0 astring, doc (showString "`"), prt 0 type_, doc (showString "`")])
      Fort.Abs.If _ layoutelemifbranchs -> prPrec i 7 (concatD [doc (showString "if"), doc (showString "{"), prt 0 layoutelemifbranchs, doc (showString "}")])
      Fort.Abs.Parens _ exp -> prPrec i 7 (concatD [doc (showString "("), prt 0 exp, doc (showString ")")])
      Fort.Abs.Record _ fielddecls -> prPrec i 7 (concatD [doc (showString "{"), prt 0 fielddecls, doc (showString "}")])
      Fort.Abs.Scalar _ scalar -> prPrec i 7 (concatD [prt 0 scalar])
      Fort.Abs.Tuple _ tupleelemexp tupleelemexps -> prPrec i 7 (concatD [doc (showString "("), prt 0 tupleelemexp, doc (showString ","), prt 0 tupleelemexps, doc (showString ")")])
      Fort.Abs.Unit _ -> prPrec i 7 (concatD [doc (showString "()")])
      Fort.Abs.Var _ lident -> prPrec i 7 (concatD [prt 0 lident])
      Fort.Abs.XArray _ layoutelemexps -> prPrec i 7 (concatD [doc (showString "array"), doc (showString "{"), prt 0 layoutelemexps, doc (showString "}")])
      Fort.Abs.XDot _ exp lident -> prPrec i 7 (concatD [prt 7 exp, doc (showString "."), prt 0 lident])
      Fort.Abs.XRecord _ layoutelemfielddecls -> prPrec i 7 (concatD [doc (showString "record"), doc (showString "{"), prt 0 layoutelemfielddecls, doc (showString "}")])
  
  instance Print (Fort.Abs.ExpDecl' a) where
    prt i = \case
      Fort.Abs.Binding _ binding exp -> prPrec i 0 (concatD [prt 0 binding, doc (showString "="), prt 0 exp])
  
  instance Print (Fort.Abs.FieldDecl' a) where
    prt i = \case
      Fort.Abs.FieldDecl _ lident exp -> prPrec i 0 (concatD [prt 0 lident, doc (showString "="), prt 0 exp])
  
  instance Print (Fort.Abs.Fixity' a) where
    prt i = \case
      Fort.Abs.InfixL _ -> prPrec i 0 (concatD [doc (showString "infixl")])
      Fort.Abs.InfixN _ -> prPrec i 0 (concatD [doc (showString "infix")])
      Fort.Abs.InfixR _ -> prPrec i 0 (concatD [doc (showString "infixr")])
  
  instance Print (Fort.Abs.IfBranch' a) where
    prt i = \case
      Fort.Abs.IfBranch _ exp1 exp2 -> prPrec i 0 (concatD [prt 4 exp1, doc (showString "->"), prt 0 exp2])
  
  instance Print (Fort.Abs.InfixInfo' a) where
    prt i = \case
      Fort.Abs.InfixInfo _ quallident fixity adouble -> prPrec i 0 (concatD [prt 0 quallident, prt 0 fixity, prt 0 adouble])
  
  instance Print (Fort.Abs.InfixOp' a) where
    prt i = \case
      Fort.Abs.InfixOp _ infixoptok -> prPrec i 0 (concatD [prt 0 infixoptok])
  
  instance Print (Fort.Abs.LIdent' a) where
    prt i = \case
      Fort.Abs.LIdent _ lidenttok -> prPrec i 0 (concatD [prt 0 lidenttok])
  
  instance Print (Fort.Abs.Pat' a) where
    prt i = \case
      Fort.Abs.PParens _ pat -> prPrec i 0 (concatD [doc (showString "("), prt 0 pat, doc (showString ")")])
      Fort.Abs.PTuple _ tupleelempat tupleelempats -> prPrec i 0 (concatD [doc (showString "("), prt 0 tupleelempat, doc (showString ","), prt 0 tupleelempats, doc (showString ")")])
      Fort.Abs.PTyped _ pat type_ -> prPrec i 0 (concatD [prt 0 pat, doc (showString ":"), doc (showString "`"), prt 0 type_, doc (showString "`")])
      Fort.Abs.PUnit _ -> prPrec i 0 (concatD [doc (showString "()")])
      Fort.Abs.PVar _ lident -> prPrec i 0 (concatD [prt 0 lident])
  
  instance Print (Fort.Abs.PrefixOp' a) where
    prt i = \case
      Fort.Abs.PrefixOp _ prefixoptok -> prPrec i 0 (concatD [prt 0 prefixoptok])
  
  instance Print (Fort.Abs.QualLIdent' a) where
    prt i = \case
      Fort.Abs.Qual _ uident lident -> prPrec i 0 (concatD [prt 0 uident, doc (showString "."), prt 0 lident])
      Fort.Abs.UnQual _ lident -> prPrec i 0 (concatD [prt 0 lident])
  
  instance Print (Fort.Abs.Scalar' a) where
    prt i = \case
      Fort.Abs.AFalse _ -> prPrec i 0 (concatD [doc (showString "False")])
      Fort.Abs.ATrue _ -> prPrec i 0 (concatD [doc (showString "True")])
      Fort.Abs.Char _ chartok -> prPrec i 0 (concatD [prt 0 chartok])
      Fort.Abs.Double _ adouble -> prPrec i 0 (concatD [prt 0 adouble])
      Fort.Abs.Int _ inttok -> prPrec i 0 (concatD [prt 0 inttok])
      Fort.Abs.String _ astring -> prPrec i 0 (concatD [prt 0 astring])
      Fort.Abs.UInt _ uint -> prPrec i 0 (concatD [prt 0 uint])
  
  instance Print (Fort.Abs.Size' a) where
    prt i = \case
      Fort.Abs.SzNat _ uint -> prPrec i 0 (concatD [prt 0 uint])
      Fort.Abs.SzVar _ lident -> prPrec i 0 (concatD [prt 0 lident])
  
  instance Print (Fort.Abs.Stmt' a) where
    prt i = \case
      Fort.Abs.Stmt _ exp -> prPrec i 0 (concatD [prt 0 exp])
      Fort.Abs.XLet _ exp1 exp2 -> prPrec i 0 (concatD [prt 0 exp1, doc (showString "="), prt 0 exp2])
  
  instance Print (Fort.Abs.TField' a) where
    prt i = \case
      Fort.Abs.TField _ lident type_ -> prPrec i 0 (concatD [prt 0 lident, doc (showString ":"), prt 0 type_])
  
  instance Print (Fort.Abs.TSum' a) where
    prt i = \case
      Fort.Abs.TCon _ uident type_ -> prPrec i 0 (concatD [prt 0 uident, doc (showString ":"), prt 0 type_])
      Fort.Abs.TEnum _ uident -> prPrec i 0 (concatD [prt 0 uident])
  
  instance Print (Fort.Abs.Type' a) where
    prt i = \case
      Fort.Abs.TLam _ lidents type_ -> prPrec i 0 (concatD [doc (showString "\\"), prt 0 lidents, doc (showString "=>"), prt 0 type_])
      Fort.Abs.TFun _ type_1 type_2 -> prPrec i 1 (concatD [prt 2 type_1, doc (showString "->"), prt 1 type_2])
      Fort.Abs.TApp _ type_1 type_2 -> prPrec i 2 (concatD [prt 2 type_1, prt 3 type_2])
      Fort.Abs.TArray _ -> prPrec i 3 (concatD [doc (showString "Array")])
      Fort.Abs.TBool _ -> prPrec i 3 (concatD [doc (showString "Bool")])
      Fort.Abs.TChar _ -> prPrec i 3 (concatD [doc (showString "C")])
      Fort.Abs.TFloat _ -> prPrec i 3 (concatD [doc (showString "F")])
      Fort.Abs.TInt _ -> prPrec i 3 (concatD [doc (showString "I")])
      Fort.Abs.TName _ uident -> prPrec i 3 (concatD [prt 0 uident])
      Fort.Abs.TOpaque _ astring -> prPrec i 3 (concatD [doc (showString "Opaque"), prt 0 astring])
      Fort.Abs.TParens _ type_ -> prPrec i 3 (concatD [doc (showString "("), prt 0 type_, doc (showString ")")])
      Fort.Abs.TPointer _ -> prPrec i 3 (concatD [doc (showString "Pointer")])
      Fort.Abs.TQualName _ uident1 uident2 -> prPrec i 3 (concatD [prt 0 uident1, doc (showString "."), prt 0 uident2])
      Fort.Abs.TRecord _ layoutelemtfields -> prPrec i 3 (concatD [doc (showString "Record"), doc (showString "{"), prt 0 layoutelemtfields, doc (showString "}")])
      Fort.Abs.TSize _ uint -> prPrec i 3 (concatD [prt 0 uint])
      Fort.Abs.TSizes _ sizes -> prPrec i 3 (concatD [doc (showString "["), prt 0 sizes, doc (showString "]")])
      Fort.Abs.TString _ -> prPrec i 3 (concatD [doc (showString "String")])
      Fort.Abs.TSum _ layoutelemtsums -> prPrec i 3 (concatD [doc (showString "Sum"), doc (showString "{"), prt 0 layoutelemtsums, doc (showString "}")])
      Fort.Abs.TTuple _ tupleelemtype tupleelemtypes -> prPrec i 3 (concatD [doc (showString "("), prt 0 tupleelemtype, doc (showString ","), prt 0 tupleelemtypes, doc (showString ")")])
      Fort.Abs.TUInt _ -> prPrec i 3 (concatD [doc (showString "U")])
      Fort.Abs.TUnit _ -> prPrec i 3 (concatD [doc (showString "()")])
      Fort.Abs.TVar _ lident -> prPrec i 3 (concatD [prt 0 lident])
      Fort.Abs.TVector _ -> prPrec i 3 (concatD [doc (showString "Vector")])
  
  instance Print (Fort.Abs.UIdent' a) where
    prt i = \case
      Fort.Abs.UIdent _ uidenttok -> prPrec i 0 (concatD [prt 0 uidenttok])
  
  instance Print (Fort.Abs.UInt' a) where
    prt i = \case
      Fort.Abs.Bin _ bintok -> prPrec i 0 (concatD [prt 0 bintok])
      Fort.Abs.Dec _ dectok -> prPrec i 0 (concatD [prt 0 dectok])
      Fort.Abs.Hex _ hextok -> prPrec i 0 (concatD [prt 0 hextok])
      Fort.Abs.Oct _ octtok -> prPrec i 0 (concatD [prt 0 octtok])
  