aboutsummaryrefslogtreecommitdiff
path: root/src/Haskell/Env/Context.hs
blob: 2e6b6ccb561d4396a6be671d21d9e3f94d09796f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Haskell.Env.Context where

import Haskell.Env
import Haskell.Env.Cmd


data Context = Context { cStack :: [(Action, Env)], cBaseEnv :: Env }
  deriving (Show)

topEnv :: Context -> Env
topEnv (Context [] env) = env
topEnv (Context ((_, env):_) _) = env

pushCtx :: (Action, Env) -> Context -> Context
pushCtx pair ctx = ctx { cStack = pair : cStack ctx }