Can someone help me understand the following definition from Wadler's paper titled "Comprehending Monads"? (Excerpt is from section 3.2/page 9, i.e., the "Strictness Monad" subsection.)
Sometimes it is necessary to control order of evaluation in a lazy functional program. This is usually achieved with the computable function strict, defined by
strict f x = if x ≠ ⊥ then f x else ⊥.
Operationally, strict f x is reduced by first reducing x to weak head normal form (WHNF) and then reducing the application f x. Alternatively, it is safe to reduce x and f x in parallel, but not allow access to the result until x is in WHNF.
In the paper, we have yet to see use of the symbol made up of the two perpendicular lines (not sure what it's called) so it sort of comes out of nowhere.
Given that Wadler goes on to say that "we will use [strict] comprehensions to control the evaluation of lazy programs", it seems like a pretty important concept to understand.
undefined
. This is only one form of it though Technically bottom is also a non-terminating computation, such aslength [1..]
– Renaterenatox
is computable, thenstrict f x
evaluates tof x
, but ifx
is not computable, thenstrict f x
evaluates to "not computable". To put it differently: sayf x = 2 * x
. What isf (1 / 0)
? You can't evaluate it because you can't evaluate(1 / 0)
. – Salep