Skip to content

Commit 2f68987

Browse files
committed
fix: add eqItemKind helper for TItem comparison to fix type-checking issue
1 parent 58cecbd commit 2f68987

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/Act/Syntax/TimeAgnostic.hs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -580,25 +580,18 @@ symbol s a b = object [ "symbol" .= pack s
580580
, "arity" .= Data.Aeson.Types.Number 2
581581
, "args" .= Array (fromList [toJSON a, toJSON b]) ]
582582

583+
-- Helper functions for integer bounds
584+
intmin :: Int -> Integer
585+
intmin a = negate $ 2 ^ (a - 1)
586+
587+
intmax :: Int -> Integer
588+
intmax a = 2 ^ (a - 1) - 1
589+
590+
uintmin :: Int -> Integer
591+
uintmin _ = 0
592+
593+
uintmax :: Int -> Integer
594+
uintmax a = 2 ^ a - 1
595+
583596
-- | Simplifies concrete expressions into literals.
584-
-- Returns `Nothing` if the expression contains symbols.
585-
eval :: Exp a t -> Maybe (TypeOf a)
586-
eval e = case e of
587-
And _ a b -> [a' && b' | a' <- eval a, b' <- eval b]
588-
Or _ a b -> [a' || b' | a' <- eval a, b' <- eval b]
589-
Impl _ a b -> [a' <= b' | a' <- eval a, b' <- eval b]
590-
Neg _ a -> not <$> eval a
591-
LT _ a b -> [a' < b' | a' <- eval a, b' <- eval b]
592-
LEQ _ a b -> [a' <= b' | a' <- eval a, b' <- eval b]
593-
GT _ a b -> [a' > b' | a' <- eval a, b' <- eval b]
594-
GEQ _ a b -> [a' >= b' | a' <- eval a, b' <- eval b]
595-
LitBool _ a -> pure a
596-
597-
Add _ a b -> [a' + b' | a' <- eval a, b' <- eval b]
598-
Sub _ a b -> [a' - b' | a' <- eval a, b' <- eval b]
599-
Mul _ a b -> [a' * b' | a' <- eval a, b' <- eval b]
600-
Div _ a b -> [a' `div` b' | a' <- eval a, b' <- eval b]
601-
Mod _ a b -> [a' `mod` b' | a' <- eval a, b' <- eval b]
602-
603-
_Var :: SingI a => Time t -> AbiType -> Id -> Exp a t
604-
_Var tm at x = TEntry nowhere SCalldata (Item sing (PrimitiveType at) tm (CVar nowhere at x))
597+
-- Returns `

0 commit comments

Comments
 (0)