Skip to content

Instantly share code, notes, and snippets.

@t0yv0
Created May 8, 2012 16:31
Show Gist options
  • Save t0yv0/2637012 to your computer and use it in GitHub Desktop.
Save t0yv0/2637012 to your computer and use it in GitHub Desktop.
import Data.List
data Rolj = Oficiant
| Povar
| Somelje
deriving (Eq, Show)
data Reshenije =
Reshenije { aristid :: Rolj
, evasio :: Rolj
, rodolpho :: Rolj
} deriving Show
roli = [Oficiant, Povar, Somelje]
prostranstvo =
[Reshenije a b c | [a, b, c] <- permutations roli]
infixl 5 ==>
infixl 6 =?
infixl 6 /=?
infixl 4 &&&
g ==> h = \x -> if g x then h x else True
a =? b = \x -> a x == b
a /=? b = \x -> a x /= b
a &&& b = \x -> a x && b x
ok =
aristid =? Povar ==> evasio =? Oficiant
&&& aristid =? Oficiant ==> evasio =? Somelje
&&& evasio /=? Povar ==> rodolpho =? Oficiant
&&& rodolpho =? Somelje ==> aristid =? Oficiant
reshenija = filter ok prostranstvo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment