{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE RankNTypes #-} module Symantic.Printer where import Control.Applicative (Applicative (..)) import Control.Monad (Monad (..)) import Control.Monad.Trans.Except qualified as MT import Control.Monad.Trans.Reader qualified as MT import Control.Monad.Trans.State qualified as MT import Data.Bool (otherwise) import Data.Either (Either (..)) import Data.Eq (Eq (..)) import Data.Function (id, ($), (.)) import Data.Functor (Functor (..), (<$>)) import Data.Functor.Constant (Constant (..)) import Data.Int (Int) import Data.Kind (Constraint, Type) import Data.Maybe (Maybe (..), isJust) import Data.Proxy (Proxy (..)) import Data.Semigroup (Semigroup (..)) import Data.String (String) import GHC.Types import Text.Read (Read (..), reads) import Text.Show (Show (..)) import Unsafe.Coerce (unsafeCoerce) import Prelude (error) import Prelude qualified import Symantic.Compiler import Symantic.Parser -- TODO: var num newtype Printer meta a = Printer {unPrinter :: TermAST meta} print :: Printer meta a -> TermAST meta print = unPrinter print2 :: String -> Printer meta a1 -> Printer meta a2 -> Printer meta a3 print2 n (Printer aT) (Printer bT) = Printer $ BinTree2 (BinTree2 (BinTree0 (TokenTermAtom n)) aT) bT