I'm trying to build my own project upon an existing project called "GLFW-b-Demo".
Its apparently using something called "RWST" to simulate an environment and state:
data Env = Env
{ envEventsChan :: TQueue Event
, envWindow :: !GLFW.Window
, envGear1 :: !GL.DisplayList
, envGear2 :: !GL.DisplayList
, envGear3 :: !GL.DisplayList
, envPlane :: !GL.DisplayList
, envBlobs :: ![Blob]
, envZDistClosest :: !Double
, envZDistFarthest :: !Double
}
data State = State
{ stateWindowWidth :: !Int
, stateWindowHeight :: !Int
, stateXAngle :: !Double
, stateYAngle :: !Double
, stateZAngle :: !Double
, stateGearZAngle :: !Double
, stateZDist :: !Double
, stateMouseDown :: !Bool
, stateDragging :: !Bool
, stateDragStartX :: !Double
, stateDragStartY :: !Double
, stateDragStartXAngle :: !Double
, stateDragStartYAngle :: !Double
}
type Demo = RWST Env () State IO
And retrieving something from that environment is easy enough:
blobs <- asks envBlobs
But I also need to be able to modify the value of those "variables". Would I need to move that to the state, to be able to change it's value or can I also modify the contents of the "env" part of things?