From 91ab51fcd99dad357d80a2ed7fd7022680d1dbf4 Mon Sep 17 00:00:00 2001 From: joshvera Date: Wed, 21 Feb 2018 18:15:35 -0500 Subject: [PATCH] Add Integer instance for Evaluatable --- src/Data/Syntax/Literal.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Data/Syntax/Literal.hs b/src/Data/Syntax/Literal.hs index 2be5d5a25..94831a7bc 100644 --- a/src/Data/Syntax/Literal.hs +++ b/src/Data/Syntax/Literal.hs @@ -3,6 +3,7 @@ module Data.Syntax.Literal where import Data.Abstract.Eval import qualified Data.Abstract.Eval2 as E2 +import qualified Data.Abstract.Eval3 as E3 import Data.Abstract.FreeVariables import Data.Abstract.Value (AbstractValue(..)) import Data.Align.Generic @@ -53,6 +54,11 @@ instance ( Monad m => E2.Eval t v m Data.Syntax.Literal.Integer where eval (Data.Syntax.Literal.Integer x) = pure (integer (maybe 0 fst (readInteger x))) +instance (AbstractValue v) => + E3.Evaluatable es t v Data.Syntax.Literal.Integer where + -- TODO: This instance probably shouldn't have readInteger? + eval (Data.Syntax.Literal.Integer x) = pure (integer (maybe 0 fst (readInteger x))) + -- TODO: Should IntegerLiteral hold an Integer instead of a ByteString? -- TODO: Do we care about differentiating between hex/octal/decimal/binary integer literals?