move Prim to TIM.hs

This commit is contained in:
crumbtoo
2023-11-14 12:34:14 -07:00
parent a259d5c42b
commit 42c3ffb6ba
2 changed files with 15 additions and 13 deletions

View File

@@ -17,15 +17,6 @@ data Expr = Var Name
| IntE Int
deriving Show
data Prim = PrimConstr Int Int -- PrimConstr Tag Arity
| IntP Int
| IntAddP
| IntSubP
| IntMulP
| IntDivP
| IntNegP
deriving (Show, Eq)
infixl 2 :$
pattern (:$) :: Expr -> Expr -> Expr
pattern f :$ x = App f x
@@ -93,10 +84,6 @@ instance Pretty Alter where
instance Pretty Binding where
prettyPrec (k := v) = withPrec 0 $ IStr k <> " = " <> precPretty 0 v
instance Pretty Prim where
prettyPrec (IntP n) = withPrec maxBound $ IStr $ show n ++ "#"
prettyPrec IntAddP = withPrec maxBound $ "+#"
----------------------------------------------------------------------------------
instance Semigroup Program where

View File

@@ -38,6 +38,21 @@ type Stats = Int
----------------------------------------------------------------------------------
data Prim = PrimConstr Int Int -- PrimConstr Tag Arity
| IntP Int
| IntAddP
| IntSubP
| IntMulP
| IntDivP
| IntNegP
deriving (Show, Eq)
instance Pretty Prim where
prettyPrec (IntP n) = withPrec maxBound $ IStr $ show n ++ "#"
prettyPrec IntAddP = withPrec maxBound $ "+#"
----------------------------------------------------------------------------------
tiStatIncSteps :: Stats -> Stats
tiStatIncSteps = (+1)