Step 3: Actions 💣

So far we've described our objects and relationships between them, but our system is still quite boring, since nothing ever happens and nothing ever changes. Let's fix that!

So what are the actions in our fruit and basket system? Well, for starters, we could have a "put fruit in basket" action. In ALM, actions are just another sort of object, so we put them in with sorts. We notate this in the same way as objects:

put_fruit_in_basket :: action

Every action in ALM is a subsort of action, which itself is a subsort of universe.

What are the attributes of our put_fruit_in_basket action? Well, we probably should select a specific fruit.

In reactive settings like user interfaces, actions are often used to describe events - e.g. a button was clicked, a key was pressed, and HTTP request returned, etc.

Note that we haven't defined at all what happens when a put_fruit_in_basket action occurs; we'll do that in the next section with axioms.

And that's all there is to it! We now have a sorts, relationships, and actions for our system, which together comprise its signature. Let's see the whole thing at once:

module fruits
fruits :: universe
varieties :: { macintosh, fuji, golden_delicious, granny_smith }
apples :: universe
variety : varieties
oranges :: fruits
put_fruit_in_basket :: action
selected_fruit : fruits
good_for_baking : varieties -> booleans
in_basket : fruit -> booleans
basket_is_full : booleans
can_bake_pie : booleans