From f4cd68a76e9744945e27c8ea77a55a3bd31d7972 Mon Sep 17 00:00:00 2001 From: Felix Dilke Date: Tue, 10 Feb 2026 12:41:57 +0000 Subject: [PATCH] rearranging code --- haskell-experiments/src/Datalog/NaiveQE.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/haskell-experiments/src/Datalog/NaiveQE.hs b/haskell-experiments/src/Datalog/NaiveQE.hs index 19ce12e..07da548 100644 --- a/haskell-experiments/src/Datalog/NaiveQE.hs +++ b/haskell-experiments/src/Datalog/NaiveQE.hs @@ -48,6 +48,10 @@ computeHerbrand db = relation <- lookupRelation db relationName pure (relationName, relation) ) allRelationNames + allRelationNames :: [Text] = relationNames db + computeHerbrandSub :: Map Text Relation -> Map Text Relation + computeHerbrandSub facts = + maybe facts computeHerbrandSub (updateFacts facts) updateFacts :: Facts -> Maybe Facts updateFacts facts = if changed then Just newFacts else Nothing where @@ -59,10 +63,6 @@ computeHerbrand db = amalgamateRelationSub newFacts relation = foldr amalgamateRule newFacts (_rules relation) where amalgamateRule :: RelationRule -> NewFacts -> NewFacts - amalgamateRule rule newFacts = + amalgamateRule (RelationRule headVars body) newFacts = newFacts - computeHerbrandSub :: Map Text Relation -> Map Text Relation - computeHerbrandSub facts = - maybe facts computeHerbrandSub (updateFacts facts) - allRelationNames :: [Text] = relationNames db