Skip to content

Commit

Permalink
Merge pull request yesodweb#458 from ecognium/patch-1
Browse files Browse the repository at this point in the history
Improved documentation for ||.
  • Loading branch information
creichert committed Aug 23, 2015
2 parents 6c304b6 + d2d07a5 commit b5b9e3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion persistent/Database/Persist.hs
Expand Up @@ -67,7 +67,12 @@ f /<-. a = Filter f (Right a) NotIn

infixl 3 ||.
(||.) :: forall v. [Filter v] -> [Filter v] -> [Filter v]
-- | the OR of two lists of filters
-- | the OR of two lists of filters. For example:
-- selectList([PersonAge >. 25, PersonAge <. 30] ||. [PersonIncome >. 15000, PersonIncome <. 25000]) []
-- will filter records where a person's age is between (25 and 30) OR a person's income is between (15,000 and 25000).
-- If you are looking for an &&. operator to do (A AND B AND (C OR D)) you can use the ++ operator instead as there is no &&. For example:
-- selectList([PersonAge >. 25, PersonAge <. 30] ++ ([PersonCategory ==. 1] ||. [PersonCategory ==. 5])) []
-- will filter records where a person's age is between (25 and 30) AND (person's category is either 1 or 5)
a ||. b = [FilterOr [FilterAnd a, FilterAnd b]]

listToJSON :: [PersistValue] -> T.Text
Expand Down

0 comments on commit b5b9e3a

Please sign in to comment.