From ecd4c4aad9d5066c1d4043f1a5d93c699b44114c Mon Sep 17 00:00:00 2001
From: Determinant <ted.sybil@gmail.com>
Date: Thu, 1 Jun 2017 00:30:58 -0400
Subject: ...

---
 90-94/90.hs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 90-94/90.hs

diff --git a/90-94/90.hs b/90-94/90.hs
new file mode 100644
index 0000000..a634409
--- /dev/null
+++ b/90-94/90.hs
@@ -0,0 +1,18 @@
+import Data.Bits (shift, (.|.), (.&.), Bits)
+
+queens :: Int -> [[Int]]
+
+queens n = q 0 0 0 0
+    where q :: Int -> Int -> Int -> Int -> [[Int]]
+          q s l r d
+              | s == n = return []
+              | otherwise = do i <- [0..n-1]
+                               let p = shift 1 i
+                               if p.&.forb == 0 then
+                                   map (i:) (q (s + 1)
+                                     (shift (l.|.p) (-1))
+                                     ((shift (r.|.p) 1).&.mask)
+                                     (d.|.p))
+                               else []
+            where forb = l.|.r.|.d
+                  mask = (shift 1 n) - 1
-- 
cgit v1.2.3-70-g09d2