N-Queens Combinatorial Problem

First see the problem solved using the List monad and a Scala for comprehension.

Then see the Scala program translated into Haskell, both using a do expression and using a List comprehension.

Understand how the Scala for comprehension is desugared, and what role the withFilter function plays.

Also understand how the Haskell do expression and List comprehension are desugared, and what role the guard function plays.


Hi all, here is part 2.

See how the guard function has migrated from MonadPlus to Alternative and learn something about the latter.

Learn how to write a Scala program that draws an N-Queens solution board using the Doodle graphics library.

See how to write the equivalent Haskell program using the Gloss graphics library.
learn how to use Monoid and Foldable to compose images both in Haskell and in Scala.

Hi all, here is part 3.

Learn how to write FP code that displays a graphical representation of all the numerous N-Queens solutions for N=4,5,6,7,8.

See how to neatly solve the problem by exploiting its self-similarity and using a divide and conquer approach.

Make light work of assembling multiple images into a whole, by exploiting Doodle’s facilities for combining images using a relative layout.

See relevant FP functions, like Foldable’s intercalate and intersperse, in action.

Hi all, here is part 4.

See how feeding FP workhorses map and filter with monadic steroids turns them into the intriguing mapM and filterM.

Graduate to foldM by learning how it behaves with the help of three simple yet instructive examples of its usage.

Use the powers of foldM to generate all permutations of a collection with a simple one-liner.

Exploit what you learned about foldM to solve the N-Queens Combinatorial Problem with an iterative approach rather than a recursive one.