YAHT: Simple state monad (note to self)

First off, keep in mind that the State st a type is a function type (st -> (st, a)) and that returnState a wraps a into a function that returns a state-value,value pair when it’s applied to a state-value. bindState is a bit complicated to think about. It takes two arguments, both functions. The first …

Continue reading ‘YAHT: Simple state monad (note to self)’ »


YAHT: Computation class (note to self)

Computation wraps a result of a function in a type. augment strips the type, applies a function to the result. The function must wrap the end result in the type again. combine “joins” two results together. Making [] and instance of Computation illustrates it the best. Maybe and Failable are a bit “funny” because the …

Continue reading ‘YAHT: Computation class (note to self)’ »