view package:operational

View function for inspecting the first instruction.
View function for inspecting the first instruction.
View type for inspecting the first instruction. It has two constructors Return and :>>=. (For technical reasons, they are documented at ProgramViewT.)
View type for inspecting the first instruction. This is very similar to pattern matching on lists.
  • The case (Return a) means that the program contains no instructions and just returns the result a.
  • The case (someInstruction :>>= k) means that the first instruction is someInstruction and the remaining program is given by the function k.
Utilitiy function for mapping a ProgramViewT back into a ProgramT. Semantically, the function unviewT is an inverse of viewT, e.g. we have
viewT (singleton i) >>= unviewT = return (singleton i)