Commit db56cf4e authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Provide more useful ToPredicate instances

parent 0ef2b1f8
...@@ -75,14 +75,14 @@ p ? e = do ...@@ -75,14 +75,14 @@ p ? e = do
bool <- toPredicate p bool <- toPredicate p
if bool then e else mempty if bool then e else mempty
instance (c ~ c', b ~ b') => ToPredicate (Predicate c b) c' b' where
toPredicate = id
instance ToPredicate Bool c b where instance ToPredicate Bool c b where
toPredicate = pure toPredicate = pure
instance ToPredicate (Action Bool) c b where instance ToPredicate p c b => ToPredicate (Action p) c b where
toPredicate = expr toPredicate = toPredicate . expr
instance (c ~ c', b ~ b', ToPredicate p c' b') => ToPredicate (Expr c b p) c' b' where
toPredicate p = toPredicate =<< p
-- | Interpret a given expression according to the given 'Target'. -- | Interpret a given expression according to the given 'Target'.
interpret :: Target c b -> Expr c b a -> Action a interpret :: Target c b -> Expr c b a -> Action a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment