on master help sign in
fix misnamed Countable/Finite cardinality
commit781a9f814b1db99bec2019f5a3aa1c077d356d77 authorAgentM <agentm@themactionfaction.com> dateThu 3 Dec 2015, 21:56 (11 years ago) parentf259833
6 files changed+9−10
Database/Persist/ProjectM36.hs+2−2 ProjectM36/Base.hs+1−2 ProjectM36/DataTypes/Interval.hs+2−2 ProjectM36/Relation.hs+2−2 TutorialD/Interpreter/DataTypes/Interval.hs+1−1 test/TutorialD/Interpreter.hs+1−1
Database/Persist/ProjectM36.hs+2−2
@@ -407,9 +407,9 @@ instance PersistUnique ProjectM36Backend where
407407 case singletonRel of
408408 Left err -> throwRelErr err
409409 Right singletonRel' -> do
410− if cardinality singletonRel' == Countable 0 then
410+ if cardinality singletonRel' == Finite 0 then
411411 return Nothing
412− else if cardinality singletonRel' > Countable 1 then
412+ else if cardinality singletonRel' > Finite 1 then
413413 Trans.liftIO $ throwIO (PersistError "getBy returned more than one tuple")
414414 else -- exactly one tuple
415415 case singletonTuple singletonRel' of
ProjectM36/Base.hs+1−2
@@ -207,8 +207,7 @@ instance Hashable Relation where
207207
208208instance Binary Relation
209209
210−data RelationCardinality = Uncountable | Countable Int deriving (Eq, Show, Generic, Ord)
211−data RelationSizeInfinite = RelationSizeInfinite
210+data RelationCardinality = Countable | Finite Int deriving (Eq, Show, Generic, Ord)
212211
213212-- | Relation variables are identified by their names.
214213type RelVarName = StringType
ProjectM36/DataTypes/Interval.hs+2−2
@@ -2,8 +2,8 @@
22{-# OPTIONS_GHC -fno-warn-orphans #-}
33module ProjectM36.DataTypes.Interval where
44import Data.Interval
5−import ProjectM36.Base
6−import Data.Binary
5+import ProjectM36.Base hiding (Finite)
6+import Data.Binary
77import ProjectM36.Atom
88import Data.Typeable
99import Data.Time.Clock
ProjectM36/Relation.hs+2−2
@@ -66,7 +66,7 @@ relationFalse = Relation A.emptyAttributes emptyTupleSet
6666
6767--if the relation contains one tuple, return it, otherwise Nothing
6868singletonTuple :: Relation -> Maybe RelationTuple
69−singletonTuple rel@(Relation _ tupleSet) = if cardinality rel == Countable 1 then
69+singletonTuple rel@(Relation _ tupleSet) = if cardinality rel == Finite 1 then
7070 Just $ head $ asList tupleSet
7171 else
7272 Nothing
@@ -113,7 +113,7 @@ degree :: Relation -> Int
113113degree = arity
114114
115115cardinality :: Relation -> RelationCardinality --we need to detect infinite tuple sets- perhaps with a flag
116−cardinality (Relation _ tupSet) = Countable (length (asList tupSet))
116+cardinality (Relation _ tupSet) = Finite (length (asList tupSet))
117117
118118--find tuples where the atoms in the relation which are NOT in the AttributeNameSet are equal
119119-- create a relation for each tuple where the attributes NOT in the AttributeNameSet are equal
TutorialD/Interpreter/DataTypes/Interval.hs+1−1
@@ -1,7 +1,7 @@
11module TutorialD.Interpreter.DataTypes.Interval where
22import Text.Parsec
33import Text.Parsec.String
4−import ProjectM36.Base
4+import ProjectM36.Base hiding (Finite)
55import ProjectM36.DataTypes.Interval ()
66import TutorialD.Interpreter.Base
77import TutorialD.Interpreter.DataTypes.DateTime
test/TutorialD/Interpreter.hs+1−1
@@ -8,7 +8,7 @@ import ProjectM36.Relation
88import ProjectM36.Tuple
99import ProjectM36.TupleSet
1010import ProjectM36.Error
11−import ProjectM36.Base
11+import ProjectM36.Base hiding (Finite)
1212import qualified ProjectM36.Base as Base
1313import ProjectM36.TransactionGraph
1414import ProjectM36.Client