From 2c4d23dcb6768f14f5efb26c9bfb3ed306538f65 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 4 Oct 2019 18:27:53 -0400 Subject: [PATCH] Fix Analysis.Eval. --- semantic-core/src/Analysis/Eval.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/semantic-core/src/Analysis/Eval.hs b/semantic-core/src/Analysis/Eval.hs index d645d355b..575371c81 100644 --- a/semantic-core/src/Analysis/Eval.hs +++ b/semantic-core/src/Analysis/Eval.hs @@ -12,7 +12,7 @@ module Analysis.Eval ) where import Control.Applicative (Alternative (..)) -import Control.Effect.Carrier +import Control.Carrier import Control.Effect.Fail import Control.Effect.Reader import Control.Monad ((>=>)) @@ -28,8 +28,7 @@ import Data.Text (Text) import GHC.Stack import Prelude hiding (fail) -eval :: ( Carrier sig m - , Member (Reader Loc) sig +eval :: ( Has (Reader Loc) sig m , MonadFail m , Semigroup value ) @@ -93,30 +92,30 @@ eval Analysis{..} eval = \case Term (L (Ann loc c)) -> local (const loc) (ref c) -prog1 :: (Carrier sig t, Member Core sig) => File (t Name) +prog1 :: Has Core sig t => File (t Name) prog1 = fromBody $ lam (named' "foo") ( named' "bar" :<- pure "foo" >>>= Core.if' (pure "bar") (Core.bool False) (Core.bool True)) -prog2 :: (Carrier sig t, Member Core sig) => File (t Name) +prog2 :: Has Core sig t => File (t Name) prog2 = fromBody $ fileBody prog1 $$ Core.bool True -prog3 :: (Carrier sig t, Member Core sig) => File (t Name) +prog3 :: Has Core sig t => File (t Name) prog3 = fromBody $ lams [named' "foo", named' "bar", named' "quux"] (Core.if' (pure "quux") (pure "bar") (pure "foo")) -prog4 :: (Carrier sig t, Member Core sig) => File (t Name) +prog4 :: Has Core sig t => File (t Name) prog4 = fromBody ( named' "foo" :<- Core.bool True >>>= Core.if' (pure "foo") (Core.bool True) (Core.bool False)) -prog5 :: (Carrier sig t, Member Ann sig, Member Core sig) => File (t Name) +prog5 :: (Has Ann sig t, Has Core sig t) => File (t Name) prog5 = fromBody $ ann (do' [ Just (named' "mkPoint") :<- lams [named' "_x", named' "_y"] (ann (Core.record [ ("x", ann (pure "_x")) @@ -127,7 +126,7 @@ prog5 = fromBody $ ann (do' , Nothing :<- ann (ann (pure "point") Core.... "y") .= ann (ann (pure "point") Core.... "x") ]) -prog6 :: (Carrier sig t, Member Core sig) => [File (t Name)] +prog6 :: Has Core sig t => [File (t Name)] prog6 = [ File (Loc "dep" (locSpan (fromJust here))) $ Core.record [ ("dep", Core.record [ ("var", Core.bool True) ]) ] @@ -137,7 +136,7 @@ prog6 = ]) ] -ruby :: (Carrier sig t, Member Ann sig, Member Core sig) => File (t Name) +ruby :: (Has Ann sig t, Has Core sig t) => File (t Name) ruby = fromBody $ annWith callStack (rec (named' __semantic_global) (do' statements)) where statements = [ Just "Class" :<- record