Actions and Effects
Not logged in

Actions and Effects

All side-effects in SiCL occur via Actions. Rather than being executed directly, a side-effecting function builds a description of the actions to be performed as an Action object and returns it. This is similar to the IO monad in Haskell, but I haven't decided whether it will actually be a monad (probably, yes).

Each action is represented by a value of type Action:

type a e Action

Where 'a' is the type of value returned by the action, and e is the type of side-effect it may have. Some example side-effects are:

These can be combined as variants: (NonDeterministic | Input)

(Need to think about whether tracking these effects is really that useful).

Almost all actions result from sending messages to agents, using the (<-) operator:

val (<-) : m Agent -> a m -> a Action

i.e., given an agent that accepts messages of polymorphic type m, and a message of type 'a m' it returns an action to produce a value of type a.