Tag Archives: monad

Short-circuiting

View literate file on Github Short-circuiting in imperative languages is a doddle – just put a break; to get out of a loop. Having said that, things are trickier when you want to break out into various levels within nested … Continue reading

Posted in Haskell | Tagged , | Leave a comment

Quickie: Generating the powerset

View literate file on Github > import Control.Monad The traditional way to generate the powerset of a list of elements is the following > powerset :: [a] -> [[a]] > powerset (x:xs) = map (x:) (powerset xs) ++ powerset xs … Continue reading

Posted in Haskell | Tagged , , | Leave a comment