1 module Symantic.Printer where
3 import Control.Applicative (Applicative (..))
4 import Control.Monad (Monad (..))
5 import Control.Monad.Trans.Except qualified as MT
6 import Control.Monad.Trans.Reader qualified as MT
7 import Control.Monad.Trans.State qualified as MT
8 import Data.Bool (otherwise)
9 import Data.Either (Either (..))
10 import Data.Eq (Eq (..))
11 import Data.Function (id, ($), (.))
12 import Data.Functor (Functor (..), (<$>))
13 import Data.Functor.Constant (Constant (..))
15 import Data.Kind (Constraint, Type)
16 import Data.Maybe (Maybe (..), isJust)
17 import Data.Proxy (Proxy (..))
18 import Data.Semigroup (Semigroup (..))
19 import Data.String (String)
21 import Text.Read (Read (..), reads)
22 import Text.Show (Show (..))
23 import Unsafe.Coerce (unsafeCoerce)
24 import Prelude (error)
25 import Prelude qualified
27 import Symantic.Compiler
28 import Symantic.Parser
30 newtype Printer a = Printer {unPrinter :: TermAST}
31 print :: Printer a -> TermAST
33 print2 :: String -> Printer a1 -> Printer a2 -> Printer a3
34 print2 n (Printer aT) (Printer bT) = Printer $ BinTree2 (BinTree2 (BinTree0 (TokenTermAtom n)) aT) bT