Tag Archives: pattern

Haskell Abstractions At Work (Part II – An Interlude)

View literate file on Github The boss wants more So the boss comes back and says, “Naren, this is great but I don’t want to write code to specify my schedule”. He scribbles some notes on the whiteboard to illustrate … Continue reading

Posted in Haskell | Tagged , , , | Leave a comment

Haskell Abstractions At Work (Part I)

View literate file on Github Recently, while constructing a domain-specific language (DSL), I had to solve a problem analogous to the following. You are given a company with boss and employees represented by their free-time schedules. For instance, is an … Continue reading

Posted in Haskell | Tagged , , | Leave a comment

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