-- ==================================================
-- Modelling Environments
-- ==================================================

newstore id = 0


update id val store = store'
	where store' id'
		| id' == id		= val
		| otherwise		= store id'

env1 = update 'a' 1 (update 'b' 2 (newstore))
env2 = update 'b' 3 env1

-- env1 'b'
-- env2 'b'
-- env2 'z'

id <<- val = \ store -> update id val store

env3 = ('b' <<- 4) env1

env4 = ('a' <<- 1) (('b' <<- 3) (('c' <<- 2) newstore))

-- env4 'b'
-- ('b' <<- 10) env4 'b'

-- ==================================================
