
2 Oct
2015
2 Oct
'15
2:02 p.m.
how can I express that two things are equal to each other without knowing the exact value and
how do I manage to make both assume a value once one of them becomes known.
I'm sure there are fancier ways to express such things, but you could use a placeholder (an Integer for instance, wrapped in a newtype) for the room reservation, together with a Map from Integer to Room to look up the room assigned to each reservation. As long as no room is assigned to a reservation number, a lookup in the map yields Nothing. Once a room is assigned, a lookup yields the room. All this should probably be wrapped up in the State Monad (the Map with the reservations being the state), so you don't have to carry around the Map explicitly. Hope this is helps.