Skip to content

Instantly share code, notes, and snippets.

@BenBals
Created March 26, 2016 16:02
Show Gist options
  • Save BenBals/e32ce119360759aee265 to your computer and use it in GitHub Desktop.
Save BenBals/e32ce119360759aee265 to your computer and use it in GitHub Desktop.
how to get a powerset of any given list in Haskell. Mind = Blown
import Control.Monad
powerset :: [a] -> [[a]]
powerset = filterM (\n -> [True,False])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment