From 42c3ffb6baa37083fc53687a8ba163d0eaba623b Mon Sep 17 00:00:00 2001 From: crumbtoo Date: Tue, 14 Nov 2023 12:34:14 -0700 Subject: [PATCH] move Prim to TIM.hs --- src/Core.hs | 13 ------------- src/TIM.hs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Core.hs b/src/Core.hs index 2d8f152..e25b9b8 100644 --- a/src/Core.hs +++ b/src/Core.hs @@ -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 diff --git a/src/TIM.hs b/src/TIM.hs index 600f711..4ad4fc1 100644 --- a/src/TIM.hs +++ b/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 = (+1)