Commit e6fec8f3 authored by Camil Staps's avatar Camil Staps 🍃

Remove "import .. as" (not supported by master compiler)

parent bfbe79bc
......@@ -13,9 +13,9 @@ implementation module Gast.Gen
import StdEnv, StdFunc, StdGeneric, Math.Random, Data.Maybe, Data.Functor, Data.List
from Data.Set import :: Set
import qualified Data.Set as Set
import qualified Data.Set
from Data.Map import :: Map, instance Functor (Map k)
import qualified Data.Map as Map
import qualified Data.Map
from Data.Func import $
// -------
......@@ -58,14 +58,14 @@ genState =
, mode = SkewGeneration { skewl = 1
, skewr = 3
}
, recInfo = 'Map'.newMap
, recInfo = 'Data.Map'.newMap
, pairTree = PTLeaf
, recFieldValueNrLimits = 'Map'.newMap
, recFieldValueNrLimits = 'Data.Map'.newMap
}
// ================= skew generation ================= //
directNames :: GenericTypeDefDescriptor -> Set TypeName
directNames gtd = 'Set'.fromList (foldr scan [] gtd.gtd_conses)
directNames gtd = 'Data.Set'.fromList (foldr scan [] gtd.gtd_conses)
where
scan gcd = allTypes (init (types gcd.gcd_type)) // init removes the type itself, as required.
......@@ -82,8 +82,8 @@ where
addRecInfo :: TypeName (Set TypeName) (Map TypeName (Set TypeName)) -> Map TypeName (Set TypeName)
addRecInfo name names ri
# ri = (\types -> if ('Set'.member name types) ('Set'.union types names) types) <$> ri
= 'Map'.alter (Just o maybe names ('Set'.union names)) name ri
# ri = (\types -> if ('Data.Set'.member name types) ('Data.Set'.union types names) types) <$> ri
= 'Data.Map'.alter (Just o maybe names ('Data.Set'.union names)) name ri
recArgs :: TypeName (Map TypeName (Set TypeName)) GenType -> [Bool]
recArgs typeName ri genType = scanArgs genType
......@@ -95,7 +95,7 @@ where
recCount :: GenType -> Bool
recCount (GenTypeApp t1 t2) = recCount t1 || recCount t2
recCount (GenTypeArrow t1 t2) = recCount t1 || recCount t2
recCount (GenTypeCons name) = maybe False ('Set'.member typeName) ('Map'.get name ri)
recCount (GenTypeCons name) = maybe False ('Data.Set'.member typeName) ('Data.Map'.get name ri)
recCount genType = False
genPairTree :: [Bool] Int -> PairTree
......@@ -190,7 +190,7 @@ where
ggen{|FIELD of d|} f s = [FIELD fi \\ fi <- vals]
where
vals = case 'Map'.get (d.gfd_cons.grd_name, d.gfd_name) s.recFieldValueNrLimits of
vals = case 'Data.Map'.get (d.gfd_cons.grd_name, d.gfd_name) s.recFieldValueNrLimits of
Nothing -> f s
Just limit -> take limit $ f s
......
......@@ -16,7 +16,7 @@ import StdEnv
from Data.Func import $
import Data.Functor
from Data.List import instance Functor [], concatMap
import qualified Data.Map as Map
import qualified Data.Map
import Math.Random
import Testing.TestEvents
import Text
......@@ -34,7 +34,7 @@ instance == Result where (==) x y = x===y
newAdmin :: Admin
newAdmin = { res=Undef, labels=[], args=[], argsRepresentation = [], failedAssertions = []
, namePath = []
, recFieldValueNrLimits = 'Map'.newMap
, recFieldValueNrLimits = 'Data.Map'.newMap
}
instance Testable Bool where
......
......@@ -17,7 +17,7 @@ import StdString
from Data.Func import $
import Data.GenLexOrd
from Data.Set import :: Set, instance == (Set a), instance Foldable Set
import qualified Data.Set as S
import qualified Data.Set
import Gast
import Gast.CommandLine
......@@ -42,28 +42,28 @@ instance < Enum where < x y = (x =?= y) === LT
derive bimap []
membership :: Enum [Enum] -> Property
membership x xs = 'S'.member x ('S'.fromList xs) <==> isMember x xs
membership x xs = 'Data.Set'.member x ('Data.Set'.fromList xs) <==> isMember x xs
conversion_invariant :: [Enum] -> Bool
conversion_invariant xs = xs` == 'S'.fromList ('S'.toList xs`)
where xs` = 'S'.fromList xs
conversion_invariant xs = xs` == 'Data.Set'.fromList ('Data.Set'.toList xs`)
where xs` = 'Data.Set'.fromList xs
length_correct :: [Enum] -> Bool
length_correct xs = 'S'.size ('S'.fromList xs) == length (removeDup xs)
length_correct xs = 'Data.Set'.size ('Data.Set'.fromList xs) == length (removeDup xs)
subset_correct :: [Enum] [Enum] -> Property
subset_correct xs ys = 'S'.isSubsetOf ('S'.fromList xs) ('S'.fromList ys)
subset_correct xs ys = 'Data.Set'.isSubsetOf ('Data.Set'.fromList xs) ('Data.Set'.fromList ys)
<==> all (flip isMember ys) xs
proper_subset_correct :: [Enum] [Enum] -> Property
proper_subset_correct xs ys = 'S'.isProperSubsetOf ('S'.fromList xs) ('S'.fromList ys)
proper_subset_correct xs ys = 'Data.Set'.isProperSubsetOf ('Data.Set'.fromList xs) ('Data.Set'.fromList ys)
<==> all (flip isMember ys) xs && not (all (flip isMember xs) ys)
newSet_is_empty :: Property
newSet_is_empty = name "newSet_is_empty" $ 'S'.null 'S'.newSet
newSet_is_empty = name "newSet_is_empty" $ 'Data.Set'.null 'Data.Set'.newSet
emptyset :: [Enum] -> Property
emptyset xs =
('S'.size xs` == 0 <==> 'S'.null xs`) /\
(xs` == 'S'.newSet <==> 'S'.null xs`)
where xs` = 'S'.fromList xs
('Data.Set'.size xs` == 0 <==> 'Data.Set'.null xs`) /\
(xs` == 'Data.Set'.newSet <==> 'Data.Set'.null xs`)
where xs` = 'Data.Set'.fromList xs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment