19 lines
555 B
Haskell
19 lines
555 B
Haskell
module Data.String.Ubc.Parse.StructScope
|
|
( StructScope(..)
|
|
, modifyVariables
|
|
)
|
|
where
|
|
|
|
import Data.Map (Map)
|
|
|
|
import Data.String.Ubc.Parse.StructVariable (StructVariable)
|
|
|
|
data StructScope = StructScope
|
|
{ structName :: String
|
|
, variables :: Map String StructVariable
|
|
}
|
|
|
|
modifyVariables :: (Map String StructVariable -> Map String StructVariable) -> StructScope -> StructScope
|
|
modifyVariables f scope@StructScope{variables = oldVariables} = scope{variables = newVariables}
|
|
where
|
|
newVariables = f oldVariables
|