1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Concretize using the smart constructors.

This commit is contained in:
Rob Rix 2019-12-13 11:43:56 -05:00
parent a8d670cd19
commit fbd86f3115
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -15,7 +15,6 @@ import Analysis.Effect.Domain as A
import Analysis.Effect.Env as A
import Analysis.Effect.Heap as A
import Analysis.File
import qualified Analysis.Intro as A
import Control.Algebra
import Control.Applicative (Alternative (..))
import Control.Effect.Fail
@ -67,10 +66,10 @@ eval Analysis{..} eval = \case
Unit -> A.unit
Bool b -> A.bool b
If c t e -> do
A.Bool c' <- eval c >>= A.concretize
c' <- eval c >>= A.asBool
if c' then eval t else eval e
String s -> A.string s
Load p -> eval p >>= A.concretize >> A.unit -- FIXME: add a load command or something
Load p -> eval p >>= A.asString >> A.unit -- FIXME: add a load command or something
Record fields -> traverse (traverse eval) fields >>= record
a :. b -> do
a' <- ref a
@ -96,7 +95,7 @@ eval Analysis{..} eval = \case
Var n -> lookupEnv' n
Alg (R c) -> case c of
If c t e -> do
A.Bool c' <- eval c >>= A.concretize
c' <- eval c >>= A.asBool
if c' then ref t else ref e
a :. b -> do
a' <- ref a