Created
August 19, 2012 20:11
-
-
Save llelf/3397364 to your computer and use it in GitHub Desktop.
fpfp-august
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.Logic | |
import Data.List | |
foo :: Logic Bool | |
foo = do [c2,c3,c4,c5,c6,c7,cJ,cA] <- sequence . replicate 8 $ return True `mplus` return False | |
guard $ c3 `thinks` sane cA | |
guard $ c4 `thinks` not (not (sane c2) && not (sane c3)) | |
guard $ c5 `thinks` sane cA == sane c4 | |
guard $ c6 `thinks` sane cA && sane c2 | |
guard $ c7 `thinks` not (sane c5) | |
guard $ cJ `thinks` not (not (sane c6) && not (sane c7)) | |
return cJ | |
where a `thinks` b = a == b | |
sane a = a | |
answer = nub $ observeAll foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment