-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathState.hs
More file actions
24 lines (18 loc) · 961 Bytes
/
State.hs
File metadata and controls
24 lines (18 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{-# LANGUAGE RankNTypes, TypeSynonymInstances, FlexibleInstances #-}
module State where
import qualified Data.HashTable.IO as H
import DependentTypes.Core
import Syntax
import Control.Monad.Trans.State.Strict -- trying state monad transformer to maintain state
type IntState a = StateT InterpreterState IO a
type HashTable k v = H.BasicHashTable k v
type ExpressionTable = HashTable Name FlExpr
type CoreExpressionTable = HashTable Name Expr
data InterpreterState = InterpreterState {
funTable :: ExpressionTable, -- global function and operator table
symTable :: ExpressionTable, -- global symbol table for variable bidnings
localSymTable :: ExpressionTable, -- local table in the current scope (e.g., when processing a function call)
typeTable :: ExpressionTable,
logs :: [String],
lambdas :: CoreExpressionTable -- here we will store named lambda expressions for *both Constructors AND normal functions!!!*
} deriving Show