delinting
This commit is contained in:
parent
d75a6b054d
commit
697568a8c3
@ -1,8 +1,8 @@
|
|||||||
{-# HLINT ignore "Redundant flip" #-}
|
{-# HLINT ignore "Redundant flip" #-}
|
||||||
{-# LANGUAGE ImportQualifiedPost #-}
|
-- {-# LANGUAGE ImportQualifiedPost #-}
|
||||||
|
-- {-# LANGUAGE InstanceSigs #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
|
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
|
||||||
{-# LANGUAGE InstanceSigs #-}
|
|
||||||
{-# LANGUAGE BlockArguments #-}
|
{-# LANGUAGE BlockArguments #-}
|
||||||
|
|
||||||
module Datalog.NaiveQE where
|
module Datalog.NaiveQE where
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
{-# HLINT ignore "Redundant flip" #-}
|
{-# HLINT ignore "Redundant flip" #-}
|
||||||
{-# LANGUAGE ImportQualifiedPost #-}
|
-- {-# LANGUAGE ImportQualifiedPost #-}
|
||||||
|
-- {-# LANGUAGE InstanceSigs #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
|
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
|
||||||
{-# LANGUAGE InstanceSigs #-}
|
|
||||||
{-# LANGUAGE BlockArguments #-}
|
{-# LANGUAGE BlockArguments #-}
|
||||||
|
|
||||||
module Datalog.QueryEngine where
|
module Datalog.QueryEngine where
|
||||||
|
|||||||
@ -28,7 +28,7 @@ extractRule ruleText =
|
|||||||
appendRule :: Relation -> RelationRule -> Relation
|
appendRule :: Relation -> RelationRule -> Relation
|
||||||
appendRule relation rule =
|
appendRule relation rule =
|
||||||
relation {
|
relation {
|
||||||
_rules = rule : (_rules relation)
|
_rules = rule : _rules relation
|
||||||
}
|
}
|
||||||
|
|
||||||
toRuleBodyElement :: BodyConstraint -> RuleBodyElement
|
toRuleBodyElement :: BodyConstraint -> RuleBodyElement
|
||||||
@ -69,7 +69,7 @@ data (DatalogDB db) => RuleContext db = RuleContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
digestHead :: (DatalogDB db) => db -> Relation -> Literal -> RuleContext db
|
digestHead :: (DatalogDB db) => db -> Relation -> Literal -> RuleContext db
|
||||||
digestHead db relation (Literal neg relationName terms) =
|
digestHead db relation (Literal _ _ terms) =
|
||||||
RuleContext
|
RuleContext
|
||||||
{ __relation = relation
|
{ __relation = relation
|
||||||
, _variableNames = variableNames
|
, _variableNames = variableNames
|
||||||
@ -79,13 +79,13 @@ digestHead db relation (Literal neg relationName terms) =
|
|||||||
}
|
}
|
||||||
where
|
where
|
||||||
variableNames = nub $ extractVariableNames terms
|
variableNames = nub $ extractVariableNames terms
|
||||||
entries' = nub $ (headTermToElement variableNames) <$> terms
|
entries' = nub $ headTermToElement variableNames <$> terms
|
||||||
extraConstants = Set.fromList $ mapMaybe extractConstant entries' where
|
extraConstants = Set.fromList $ mapMaybe extractConstant entries' where
|
||||||
extractConstant :: RuleElement -> Maybe Constant
|
extractConstant :: RuleElement -> Maybe Constant
|
||||||
extractConstant (RuleElementConstant constant) = Just constant
|
extractConstant (RuleElementConstant constant) = Just constant
|
||||||
extractConstant _ = Nothing
|
extractConstant _ = Nothing
|
||||||
digestBody :: (DatalogDB db) => Literal -> RuleContext db -> RuleContext db
|
digestBody :: (DatalogDB db) => Literal -> RuleContext db -> RuleContext db
|
||||||
digestBody (Literal neg subRelationName subTerms) context =
|
digestBody (Literal _ subRelationName subTerms) context =
|
||||||
context {
|
context {
|
||||||
_variableNames = variableNames
|
_variableNames = variableNames
|
||||||
, _bodyConstraints = newConstraint : constraints
|
, _bodyConstraints = newConstraint : constraints
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user