Difference between revisions of "PFP Laboratory 11"

From Marek Běhálek Wiki
Jump to navigation Jump to search
(Created page with "== State monad== * In your prefered programming language, define a function representing a state: <code>State s a :: s -> (s,a)</code>. For example in C#, it will be someth...")
 
(No difference)

Latest revision as of 08:30, 22 November 2022

State monad

  • In your prefered programming language, define a function representing a state: State s a :: s -> (s,a). For example in C#, it will be something like this:
delegate (TState State, T Value) State<TState, T>(TState state)
  • Implement functions bind and return as it is defined for monads (or SelectMany, if you are using C#).