pretty printer

uses ISeq, as described in 'Implementing Functional Languages'. going to try using a style similar to ShowS instead.
This commit is contained in:
crumbtoo
2023-11-09 14:55:03 -07:00
parent 80e55e6437
commit 708e611799
3 changed files with 61 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
module Core where
----------------------------------------------------------------------------------
import Data.Coerce
import Data.Pretty
----------------------------------------------------------------------------------
data Expr = Var Name
@@ -39,6 +40,11 @@ newtype Program = Program [ScDef]
----------------------------------------------------------------------------------
instance Pretty Expr where
prettyPrec _ (Var k) = iStr k
----------------------------------------------------------------------------------
instance Semigroup Program where
(<>) = coerce $ (++) @ScDef