Skip to content

Instantly share code, notes, and snippets.

View nqueens.hs
import Data.List
import Data.Maybe
import Data.Monoid
-- The hard stuff
solve' :: Int -> [(Int, Int)] -> [(Int, Int)] -> Solutions
solve' nq queens board
| length queens == nq = Solutions [Solution nq queens]
| length board == 0 = mempty