jtapolczai / wumpus

Affective Wumpus world.
Apache License 2.0
1 stars 0 forks source link

Add accessors for ADTs for NodeConditions #12

Closed jtapolczai closed 9 years ago

jtapolczai commented 9 years ago

(==), (<=), (>=) constraints should only work within the context of one product among the sum components of AgentMessage.

e.g. AMTemperature is one constructor of AgentMessage and it has a single Temperature field. A node should select this field and compare its value.

Something like Ord b=> (a -> b) -> a -> NodeCondition a or whatever.

jtapolczai commented 9 years ago

The getter is now backed into the NodeCondition type, which looks like this:

data NodeCondition s = forall a.Ord a => NodeEq (Prism' s a) a
                       | ...

NodeConditions can be constructed in the intuitive way: NodeEQ _AMTime 5 and checked via runCondition.