move Prim to TIM.hs
This commit is contained in:
13
src/Core.hs
13
src/Core.hs
@@ -17,15 +17,6 @@ data Expr = Var Name
|
|||||||
| IntE Int
|
| IntE Int
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
data Prim = PrimConstr Int Int -- PrimConstr Tag Arity
|
|
||||||
| IntP Int
|
|
||||||
| IntAddP
|
|
||||||
| IntSubP
|
|
||||||
| IntMulP
|
|
||||||
| IntDivP
|
|
||||||
| IntNegP
|
|
||||||
deriving (Show, Eq)
|
|
||||||
|
|
||||||
infixl 2 :$
|
infixl 2 :$
|
||||||
pattern (:$) :: Expr -> Expr -> Expr
|
pattern (:$) :: Expr -> Expr -> Expr
|
||||||
pattern f :$ x = App f x
|
pattern f :$ x = App f x
|
||||||
@@ -93,10 +84,6 @@ instance Pretty Alter where
|
|||||||
instance Pretty Binding where
|
instance Pretty Binding where
|
||||||
prettyPrec (k := v) = withPrec 0 $ IStr k <> " = " <> precPretty 0 v
|
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
|
instance Semigroup Program where
|
||||||
|
|||||||
15
src/TIM.hs
15
src/TIM.hs
@@ -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 :: Stats -> Stats
|
||||||
tiStatIncSteps = (+1)
|
tiStatIncSteps = (+1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user