From 2eb80687ea1eff9887df573168871329c466e9fc Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 1 Nov 2019 14:43:04 -0400 Subject: [PATCH] Define a smart constructor for Lookup. --- semantic-analysis/src/Analysis/Analysis.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/semantic-analysis/src/Analysis/Analysis.hs b/semantic-analysis/src/Analysis/Analysis.hs index 99f2f0195..ae9a91f9e 100644 --- a/semantic-analysis/src/Analysis/Analysis.hs +++ b/semantic-analysis/src/Analysis/Analysis.hs @@ -3,6 +3,7 @@ module Analysis.Analysis ( Analysis(..) , alloc' , bind' +, lookupEnv' , Env(..) ) where @@ -36,6 +37,9 @@ alloc' name = send (Alloc name pure) bind' :: (Carrier sig m, Member (Env name addr) sig) => name -> addr -> m a -> m a bind' name addr m = send (Bind name addr m pure) +lookupEnv' :: (Carrier sig m, Member (Env name addr) sig) => name -> m (Maybe addr) +lookupEnv' name = send (Lookup name pure) + data Env name addr m k = Alloc name (addr -> m k)