diff options
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/app/Main.hs b/app/Main.hs index 4eedc97..e7d62bf 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -374,20 +374,7 @@ satisfies :: Maybe WhereClause -> R.Records J.Value -> Bool satisfies Nothing _ = True satisfies (Just (And ws)) vs = all (\w -> satisfies (Just w) vs) ws satisfies (Just (Or ws)) vs = any (\w -> satisfies (Just w) vs) ws -satisfies (Just (Where p)) vs = satisfy p vs - -satisfy :: Comparison -> R.Records J.Value -> Bool -satisfy (Eq f g) vs = unique f vs == unique g vs - -data DuplicateField' = DuplicateField' - deriving (Show) - -instance Exception DuplicateField' - -unique :: F.Field -> R.Records J.Value -> J.Value -unique f as = case mapMaybe (R.lookup f) as of - [v] -> v - (_ : _) -> throw DuplicateField' +satisfies (Just (Where (Eq f g))) vs = R.lookups f vs == R.lookups g vs query' :: Query -> IO () query' q = mapM_ (LB.putStrLn . J.encode) =<< query q |