Commit 01c662de authored by Nicolas Lenz's avatar Nicolas Lenz

Refactioring

parent c10cbc33
......@@ -28,7 +28,6 @@ foldListExample :: Int
foldListExample = foldList (ListAlg 0 (+)) (Cons 1 $ Cons 2 $ Cons 42 Nil) -- = 1 + 2 + 42 = 45
-- | An example type definition for natural numbers.
-- Corresponds to "data Nat = One | Succ Nat".
typeExampleNat :: TypeDef
......
......@@ -18,7 +18,7 @@ prop_foldTermKatrinIdentic :: Katrin -> Bool
prop_foldTermKatrinIdentic k = foldKatrin katrinAlgTerm k == k
instance Arbitrary Katrin where
arbitrary = sized $ \n -> Katrin <$> (resize (n`div`2) arbitrary) <*> (resize (n`div`2) arbitrary)
arbitrary = sized $ \n -> Katrin <$> resize (n`div`2) arbitrary <*> resize (n`div`2) arbitrary
instance Arbitrary ValueId where
arbitrary = ValueId <$> resize 5 arbitrary
......@@ -34,16 +34,16 @@ instance Arbitrary TypeExp where
arbitrary = sized $ \n ->
frequency [
(1, ProductType <$> arbitrary <*> arbitrary),
(n, SumType <$> (resize (n`div`2) arbitrary) <*> (resize (n`div`2) arbitrary))]
(n, SumType <$> resize (n`div`2) arbitrary <*> resize (n`div`2) arbitrary)]
instance Arbitrary Def where
arbitrary = sized $ \n ->
Def <$> arbitrary <*> (resize (n`div`2) arbitrary) <*> (resize (n`div`2) arbitrary)
Def <$> arbitrary <*> resize (n`div`2) arbitrary <*> resize (n`div`2) arbitrary
instance Arbitrary Exp where
arbitrary = sized $ \n ->
frequency [
(1, Literal <$> arbitrary),
(n, Application <$> (resize (n`div`2) arbitrary) <*> (resize (n`div`2) arbitrary)),
(n, Application <$> resize (n`div`2) arbitrary <*> resize (n`div`2) arbitrary),
(1, Variable <$> arbitrary),
(n, Lambda <$> (resize (n`div`2) arbitrary) <*> (resize (n`div`2) arbitrary))]
(n, Lambda <$> resize (n`div`2) arbitrary <*> resize (n`div`2) arbitrary)]
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