3 ms·
Effects Without Monads: Non-Determinism – Back to the Meta Language
- lalaithion 7y agoI thought it would be fun to write "perm" in Haskell using the List Monad, which is sometimes referred to as expressing nondeterminism. import Data.Foldable (foldrM) insert x [] = return [x] insert x (y:ys) = do z <- insert x ys [x:y:ys, y:z] perm = foldrM insert []