@@ -526,79 +526,6 @@ instance Hashable DatabaseContextFunction where
526526instance Eq DatabaseContextFunction where
527527 f1 == f2 = dbcFuncName f1 == dbcFuncName f2
528528
529−{-
530−-- for creating arbitrary tuples
531−instance Arbitrary Text where
532− arbitrary = pack <$> elements ["Mary", "Johnny", "Sunny", "Ted"]
533−
534−instance Arbitrary Day where
535− arbitrary = ModifiedJulianDay <$> (arbitrary :: Gen Integer)
536−
537−instance Arbitrary Attribute where
538− arbitrary = genericArbitrary
539−
540−instance (Arbitrary a) => Arbitrary (V.Vector a) where
541− arbitrary = do
542− maxbound <- choose (0,5)
543− V.fromList <$> vectorOf maxbound arbitrary
544−
545−--not sure what's use on this one
546−instance {-# OVERLAPPING #-} Arbitrary TypeVarMap where
547− arbitrary = undefined
548−
549−instance Arbitrary UTCTime where
550− arbitrary = UTCTime <$> arbitrary <*> (secondsToDiffTime <$> arbitrary)
551−
552−instance Arbitrary B.ByteString where
553− arbitrary = B.pack <$> (arbitrary :: Gen String)
554−
555−defAttributeNames = ["Number","People","Time","Thing"]
556−defAtomtypes = [IntAtomType, TextAtomType, DayAtomType, TextAtomType]
557−defAttributes = V.fromList $ zipWith Attribute defAttributeNames defAtomtypes
558−
559−instance Arbitrary RelationTuple where
560− arbitrary = do
561− a <- IntAtom <$> (arbitrary :: Gen Int)
562− b <- TextAtom <$> (arbitrary :: Gen Text)
563− c <- DayAtom <$> (arbitrary :: Gen Day)
564− d <- TextAtom <$> (arbitrary :: Gen Text)
565− let sample = V.fromList [a,b,c,d]
566− return $ RelationTuple defAttributes sample
567−
568−instance Arbitrary Relation where
569− arbitrary = do
570− list <- listOf (arbitrary :: Gen RelationTuple)
571− return $ Relation defAttributes (RelationTupleSet list)
572−
573−arbitraryRelationTuple attris = do
574− let attrisG = V.fromList <$> mapM (arbitrary'.getAtomType) (V.toList attris)
575− RelationTuple attris <$> attrisG
576−
577−arbitraryRel attris bound@(min,max) = do
578− num <- choose (min,max)
579− let tupleListG = vectorOf num (arbitraryRelationTuple attris)
580− Relation attris <$> (RelationTupleSet <$> tupleListG)
581−
582−instance Arbitrary AtomType where
583− arbitrary = genericArbitrary
584−
585−instance Arbitrary Atom where
586− arbitrary = genericArbitrary
587−
588−instance ToADTArbitrary Atom
589−
590−arbitrary' :: AtomType -> Gen Atom
591−arbitrary' IntAtomType = IntAtom <$> (arbitrary :: Gen Int)
592−arbitrary' IntegerAtomType = IntegerAtom <$> (arbitrary :: Gen Integer)
593−arbitrary' TextAtomType = TextAtom <$> (arbitrary :: Gen Text)
594−arbitrary' DayAtomType = DayAtom <$> (arbitrary :: Gen Day)
595−arbitrary' BoolAtomType = BoolAtom <$> (arbitrary :: Gen Bool)
596−arbitrary' _ = undefined
597−
598−getAtomType :: Attribute -> AtomType
599−getAtomType (Attribute _ atomType) = atomType
600−-}
601−
602529attrTypeVars :: Attribute -> S.Set TypeVarName
603530attrTypeVars (Attribute _ aType) = case aType of
604531 IntAtomType -> S.empty