Monads in 15 minutes: Backtracking and Maybe - 0 views
-
type Choice a = [a] choose :: [a] -> Choice a choose xs = xs
-
Because Haskell doesn’t compute answers until we ask for them, we get the actual backtracking for free!
-
The missing function is almost too trivial to mention: Given a single value of type a, we need a convenient way to construct a value of type Choice a:
- ...5 more annotations...