code-conjure 0.2.8 → 0.3.0
raw patch · 32 files changed
+465/−274 lines, 32 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Conjure.Conjurable: conjureIf :: Conjurable a => a -> Expr
+ Conjure.Expr: enumerateApps :: (Expr -> Bool) -> [Expr] -> [[Expr]]
+ Conjure.Expr: enumerateAppsFor :: Expr -> (Expr -> Bool) -> [Expr] -> [[Expr]]
+ Conjure.Expr: possibleHoles :: [Expr] -> [Expr]
+ Conjure.Utils: groupOn :: Eq b => (a -> b) -> [a] -> [[a]]
+ Conjure.Utils: sortOn :: Ord b => (a -> b) -> [a] -> [a]
Files
- .gitignore +1/−0
- Makefile +1/−0
- bench/runtime/zero/bench/ill-hit.runtime +1/−1
- bench/runtime/zero/bench/take-drop.runtime +1/−0
- bench/runtime/zero/eg/arith.runtime +1/−1
- bench/runtime/zero/eg/bools.runtime +1/−1
- bench/runtime/zero/eg/factorial.runtime +1/−1
- bench/runtime/zero/eg/ints.runtime +1/−1
- bench/runtime/zero/eg/list.runtime +1/−1
- bench/runtime/zero/eg/spec.runtime +1/−1
- bench/runtime/zero/eg/tapps.runtime +1/−1
- bench/runtime/zero/proto/u-conjure.runtime +1/−1
- bench/runtime/zero/versions +1/−1
- bench/take-drop.hs +45/−0
- changelog.md +8/−0
- code-conjure.cabal +2/−2
- mk/depend.mk +11/−0
- src/Conjure/Conjurable.hs +4/−0
- src/Conjure/Engine.hs +9/−26
- src/Conjure/Expr.hs +65/−0
- src/Conjure/Utils.hs +10/−0
- test/expr.hs +29/−0
- test/model/bench/ill-hit.out +30/−30
- test/model/bench/self.out +12/−12
- test/model/bench/take-drop.out +33/−0
- test/model/eg/arith.out +16/−16
- test/model/eg/bools.out +28/−28
- test/model/eg/factorial.out +14/−14
- test/model/eg/ints.out +35/−35
- test/model/eg/list.out +62/−62
- test/model/eg/spec.out +21/−21
- test/model/eg/tapps.out +18/−18
.gitignore view
@@ -36,6 +36,7 @@ eg/spec bench/self bench/ill-hit+bench/take-drop proto/u-conjure test/expr test/conjurable
Makefile view
@@ -15,6 +15,7 @@ eg/tapps \ bench/ill-hit \ bench/self \+ bench/take-drop \ proto/u-conjure TESTS = \
bench/runtime/zero/bench/ill-hit.runtime view
@@ -1,1 +1,1 @@-1.89+1.64
+ bench/runtime/zero/bench/take-drop.runtime view
@@ -0,0 +1,1 @@+6.42
bench/runtime/zero/eg/arith.runtime view
@@ -1,1 +1,1 @@-0.95+0.94
bench/runtime/zero/eg/bools.runtime view
@@ -1,1 +1,1 @@-7.20+6.83
bench/runtime/zero/eg/factorial.runtime view
@@ -1,1 +1,1 @@-7.18+5.26
bench/runtime/zero/eg/ints.runtime view
@@ -1,1 +1,1 @@-1.84+1.44
bench/runtime/zero/eg/list.runtime view
@@ -1,1 +1,1 @@-10.23+3.20
bench/runtime/zero/eg/spec.runtime view
@@ -1,1 +1,1 @@-1.47+0.68
bench/runtime/zero/eg/tapps.runtime view
@@ -1,1 +1,1 @@-0.87+0.73
bench/runtime/zero/proto/u-conjure.runtime view
@@ -1,1 +1,1 @@-0.32+0.33
bench/runtime/zero/versions view
@@ -1,4 +1,4 @@ GHC 8.10.4-leancheck-0.9.4+leancheck-0.9.6 express-0.1.10 speculate-0.4.6
+ bench/take-drop.hs view
@@ -0,0 +1,45 @@+-- based code sent by Colin Runciman+import Conjure++drop' :: Int -> [a] -> [a]+drop' 0 [] = []+drop' 1 [] = []+drop' 0 [x,y] = [x,y]+drop' 1 [x,y] = [y]+drop' 2 [x,y] = []+drop' 3 [x,y] = []++take' :: Int -> [a] -> [a]+take' 0 [] = []+take' 1 [] = []+take' 0 [x,y] = []+take' 1 [x,y] = [x]+take' 2 [x,y] = [x,y]+take' 3 [x,y] = [x,y]++main :: IO ()+main = do+ -- drop n xs = if n==0 || null xs then xs else drop (dec n) (tail xs)+ -- needs size 13+ conjureWithMaxSize 13 "drop" (drop' :: Int -> [A] -> [A])+ [ val (0 :: Int)+ , value "null" (null :: [A] -> Bool)+ , value "==" ((==) :: Int -> Int -> Bool)+ , value "||" (||)+ , value "dec" (subtract 1 :: Int -> Int)+ , value "tail" (tail :: [A] -> [A])+ ]++ -- take n xs = if n==0 || null xs then [] else head xs : take (dec n) (tail xs)+ -- needs size 16+ conjureWithMaxSize 13 "take" (take' :: Int -> [A] -> [A])+ [ val (0 :: Int)+ , val ([] :: [A])+ , value "null" (null :: [A] -> Bool)+ , value "==" ((==) :: Int -> Int -> Bool)+ , value "||" ((||) :: Bool -> Bool -> Bool)+ , value "dec" ((\n -> n-1) :: Int -> Int)+ , value ":" ((:) :: A -> [A] -> [A])+ , value "head" (head :: [A] -> A)+ , value "tail" (tail :: [A] -> [A])+ ]
changelog.md view
@@ -2,6 +2,14 @@ ============================ +v0.3.0+------++* only automatically include an `if` for the return type of the given function+* add the `take-drop` benchmark+* make bottom-up enumeration more type directed++ v0.2.8 ------
code-conjure.cabal view
@@ -3,7 +3,7 @@ -- Copyright (C) 2021 Rudy Matela -- Distributed under the 3-Clause BSD licence (see the file LICENSE). name: code-conjure-version: 0.2.8+version: 0.3.0 synopsis: conjure Haskell functions out of partial definitions description: Conjure is a tool that produces Haskell functions out of partial definitions.@@ -65,7 +65,7 @@ source-repository this type: git location: https://github.com/rudymatela/conjure- tag: v0.2.8+ tag: v0.3.0 library exposed-modules: Conjure
mk/depend.mk view
@@ -20,6 +20,17 @@ src/Conjure/Engine.hs \ src/Conjure/Conjurable.hs \ bench/self.hs+bench/take-drop: \+ bench/take-drop.hs \+ mk/toplibs+bench/take-drop.o: \+ src/Conjure/Utils.hs \+ src/Conjure/Spec.hs \+ src/Conjure.hs \+ src/Conjure/Expr.hs \+ src/Conjure/Engine.hs \+ src/Conjure/Conjurable.hs \+ bench/take-drop.hs eg/arith: \ eg/arith.hs \ mk/toplibs
src/Conjure/Conjurable.hs view
@@ -106,7 +106,10 @@ conjureSubTypes :: a -> Reification conjureSubTypes _ = id + conjureIf :: a -> Expr+ conjureIf = ifFor + conjureType :: Conjurable a => a -> Reification conjureType x ms = if hole x `elem` [h | (h,_,_,_) <- ms]@@ -304,6 +307,7 @@ instance (Conjurable a, Conjurable b) => Conjurable (a -> b) where conjureArgumentHoles f = hole (argTy f) : conjureArgumentHoles (f undefined) conjureSubTypes f = conjureType (argTy f) . conjureType (resTy f)+ conjureIf f = conjureIf (f undefined) argTy :: (a -> b) -> a argTy _ = undefined
src/Conjure/Engine.hs view
@@ -25,6 +25,8 @@ ) where +import Control.Monad (when)+ import Data.Express import Data.Express.Fixtures hiding ((-==-)) @@ -130,8 +132,9 @@ where pr n [] = putStrLn $ "cannot conjure" pr n ((is,cs,es):rs) = do+ -- when (n==1) $ putStrLn $ unlines $ map show es putStrLn $ "-- looking through "- ++ show (length cs) ++ "/" ++ show (length es)+ ++ show (length cs) ++ " candidates of size " ++ show n case is of [] -> pr (n+1) rs@@ -192,33 +195,13 @@ -> [Expr] -> [[Expr]] candidateExprs nm f sz mc (===) es =- candidateExprsT nm f sz mc (===) [nub $ es ++ conjureIfs f]---candidateExprsT :: Conjurable f- => String -> f- -> Int- -> Int- -> (Expr -> Expr -> Bool)- -> [[Expr]]- -> [[Expr]]-candidateExprsT nm f sz mc (===) ess =- candidateExprsTT keep $ [ef:exs] \/ ess+ enumerateAppsFor efxs keep $ nub $ (ef:exs) ++ es ++ [conjureIf f] where- (ef:exs) = unfoldApp $ conjureVarApplication nm f+ efxs = conjureVarApplication nm f+ (ef:exs) = unfoldApp efxs keep e = isRootNormalE thy e && count (== ef) (vars e) <= mc- thy = theoryFromAtoms (===) sz $ [conjureHoles f ++ falseAndTrue]- \/ filterT (`notElem` falseAndTrue) ess- falseAndTrue = [val False, val True]---candidateExprsTT :: (Expr -> Bool) -> [[Expr]] -> [[Expr]]-candidateExprsTT keep = exprT- where- exprT ess = filterT keep- $ ess \/ (delay $ productMaybeWith ($$) rss rss)- where- rss = exprT ess+ thy = theoryFromAtoms (===) sz . (:[]) . nub+ $ conjureHoles f ++ [val False, val True] ++ es ++ [conjureIf f] candidatesTD :: (Expr -> Bool) -> Expr -> [Expr] -> [[Expr]]
src/Conjure/Expr.hs view
@@ -29,7 +29,11 @@ , rhs , ($$**) , ($$|<)+ , possibleHoles + , enumerateApps+ , enumerateAppsFor+ , module Conjure.Utils ) where@@ -40,6 +44,8 @@ import Data.Express.Utils.Typeable import Data.Express.Fixtures hiding ((-==-)) +import Test.LeanCheck (filterT, (\/), delay, productWith, productMaybeWith)+ -- | /O(n)/. -- Compares the simplicity of two 'Expr's. -- An expression /e1/ is /strictly simpler/ than another expression /e2/@@ -259,3 +265,62 @@ ktyp :: Expr -> TypeRep ktyp (e1 :$ e2) = resultTy (ktyp e1) ktyp e = typ e++possibleHoles :: [Expr] -> [Expr]+possibleHoles = nubSort . ph . nubSort . map holeAsTypeOf+ where+ ph hs = case nubSort $ hs ++ [holeAsTypeOf hfx | hf <- hs, hx <- hs, Just hfx <- [hf $$ hx]] of+ hs' | hs' == hs -> hs+ | otherwise -> ph hs'+ nubSort = nub . sort -- TODO: this is O(n^2), make this O(n log n)+++-- -- Expression enumeration -- --++enumerateAppsFor :: Expr -> (Expr -> Bool) -> [Expr] -> [[Expr]]+enumerateAppsFor = enumerateApps3For++enumerateApps :: (Expr -> Bool) -> [Expr] -> [[Expr]]+enumerateApps = enumerateApps1++enumerateApps1For :: Expr -> (Expr -> Bool) -> [Expr] -> [[Expr]]+enumerateApps1For h keep = filterT (\e -> typ e == typ h) . enumerateApps1 keep++enumerateApps1 :: (Expr -> Bool) -> [Expr] -> [[Expr]]+enumerateApps1 keep = exprT . (:[])+ where+ exprT ess = filterT keep+ $ ess \/ (delay $ productMaybeWith ($$) rss rss)+ where+ rss = exprT ess++enumerateApps2For :: Expr -> (Expr -> Bool) -> [Expr] -> [[Expr]]+enumerateApps2For h keep = map concat+ . filterT (\(e:_) -> typ e == typ h)+ . exprT+ . map (groupOn typ . sortOn typ)+ . (:[])+ where+ exprT :: [[[Expr]]] -> [[[Expr]]]+ exprT ess = ess \/ (delay $ productMaybeWith ($$**) rss rss)+ where+ rss = exprT ess+ efs $$** exs+ | isNothing (head efs $$ head exs) = Nothing+ | otherwise = case [ef :$ ex | ef <- efs, ex <- exs, keep (ef :$ ex)] of+ [] -> Nothing+ es -> Just es++enumerateApps3For :: Expr -> (Expr -> Bool) -> [Expr] -> [[Expr]]+enumerateApps3For h keep es = for h+ where+ hs :: [Expr]+ hs = possibleHoles es+ for :: Expr -> [[Expr]]+ for h = [e | e <- es, typ h == typ e]+ : foldr (\/) [] [ filterT keep $ productWith (:$) (for hf) (for hx)+ | hf <- hs+ , hx <- hs+ , Just hfx <- [hf $$ hx]+ , typ h == typ hfx+ ]
src/Conjure/Utils.hs view
@@ -20,6 +20,8 @@ , nubOn , iterateUntil , mzip+ , groupOn+ , sortOn ) where @@ -49,3 +51,11 @@ mzip [] ys = ys mzip xs [] = xs mzip (x:xs) (y:ys) = x <> y : mzip xs ys++groupOn :: Eq b => (a -> b) -> [a] -> [[a]]+groupOn f = groupBy ((==) `on` f)++#if __GLASGOW_HASKELL__ < 710+sortOn :: Ord b => (a -> b) -> [a] -> [a]+sortOn f = sortBy (compare `on` f)+#endif
test/expr.hs view
@@ -159,4 +159,33 @@ , holds n $ \e es -> not (any hasHole es) ==> boupCandidates e es =$ map sort . take 12 $= townCandidates e es++ , possibleHoles [plus, times, zero, one]+ == [ hole (undefined :: Int)+ , hole (undefined :: Int -> Int)+ , hole (undefined :: Int -> Int -> Int)+ ]++ , possibleHoles [andE, orE, false, true]+ == [ hole (undefined :: Bool)+ , hole (undefined :: Bool -> Bool)+ , hole (undefined :: Bool -> Bool -> Bool)+ ]++ , possibleHoles [plus, times, zero, one, andE, orE, false, true]+ == [ hole (undefined :: Bool)+ , hole (undefined :: Int)+ , hole (undefined :: Bool -> Bool)+ , hole (undefined :: Int -> Int)+ , hole (undefined :: Bool -> Bool -> Bool)+ , hole (undefined :: Int -> Int -> Int)+ ]++ , possibleHoles [plus, times, zero, one, value "odd" (odd :: Int -> Bool)]+ == [ hole (undefined :: Bool)+ , hole (undefined :: Int)+ , hole (undefined :: Int -> Bool)+ , hole (undefined :: Int -> Int)+ , hole (undefined :: Int -> Int -> Int)+ ] ]
test/model/bench/ill-hit.out view
@@ -1,42 +1,42 @@ sum :: [Int] -> Int -- testing 4 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4--- looking through 13/33 candidates of size 5--- looking through 26/68 candidates of size 6--- looking through 63/143 candidates of size 7--- looking through 152/336 candidates of size 8--- looking through 358/783 candidates of size 9--- looking through 860/1835 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 26 candidates of size 6+-- looking through 59 candidates of size 7+-- looking through 140 candidates of size 8+-- looking through 326 candidates of size 9+-- looking through 776 candidates of size 10 sum xs = if null xs then 0 else head xs + sum (tail xs) sum :: [Int] -> Int -- testing 6 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4--- looking through 13/33 candidates of size 5--- looking through 26/68 candidates of size 6--- looking through 63/143 candidates of size 7--- looking through 152/336 candidates of size 8--- looking through 358/783 candidates of size 9--- looking through 860/1835 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 26 candidates of size 6+-- looking through 59 candidates of size 7+-- looking through 140 candidates of size 8+-- looking through 326 candidates of size 9+-- looking through 776 candidates of size 10 sum xs = if null xs then 0 else head xs + sum (tail xs) sum :: [Int] -> Int -- testing 6 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4--- looking through 13/33 candidates of size 5--- looking through 26/68 candidates of size 6--- looking through 63/143 candidates of size 7--- looking through 152/336 candidates of size 8--- looking through 358/783 candidates of size 9--- looking through 860/1835 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 26 candidates of size 6+-- looking through 59 candidates of size 7+-- looking through 140 candidates of size 8+-- looking through 326 candidates of size 9+-- looking through 776 candidates of size 10 sum xs = if null xs then 0 else head xs + sum (tail xs)
test/model/bench/self.out view
@@ -1,27 +1,27 @@ (?) :: Int -> Int -> Int -- testing 60 combinations of argument values--- looking through 4/8 candidates of size 1--- looking through 0/12 candidates of size 2--- looking through 48/48 candidates of size 3+-- looking through 4 candidates of size 1+-- looking through 0 candidates of size 2+-- looking through 48 candidates of size 3 x ? y = x + y (?) :: Int -> Int -> Int -- testing 60 combinations of argument values--- looking through 4/8 candidates of size 1--- looking through 0/12 candidates of size 2--- looking through 48/48 candidates of size 3+-- looking through 4 candidates of size 1+-- looking through 0 candidates of size 2+-- looking through 48 candidates of size 3 x ? y = x * y i :: Int -> Int -- testing 60 combinations of argument values--- looking through 3/7 candidates of size 1--- looking through 3/9 candidates of size 2--- looking through 18/24 candidates of size 3+-- looking through 3 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 18 candidates of size 3 i x = x + 1 d :: Int -> Int -- testing 60 combinations of argument values--- looking through 3/7 candidates of size 1--- looking through 3/9 candidates of size 2--- looking through 18/24 candidates of size 3+-- looking through 3 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 18 candidates of size 3 cannot conjure
+ test/model/bench/take-drop.out view
@@ -0,0 +1,33 @@+drop :: Int -> [A] -> [A]+-- testing 60 combinations of argument values+-- looking through 1 candidates of size 1+-- looking through 1 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 7 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 23 candidates of size 6+-- looking through 45 candidates of size 7+-- looking through 111 candidates of size 8+-- looking through 301 candidates of size 9+-- looking through 789 candidates of size 10+-- looking through 1919 candidates of size 11+-- looking through 4539 candidates of size 12+-- looking through 10873 candidates of size 13+drop x y = if null y || x == 0 then y else drop (dec x) (tail y)++take :: Int -> [A] -> [A]+-- testing 60 combinations of argument values+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 18 candidates of size 4+-- looking through 34 candidates of size 5+-- looking through 94 candidates of size 6+-- looking through 268 candidates of size 7+-- looking through 792 candidates of size 8+-- looking through 2378 candidates of size 9+-- looking through 6912 candidates of size 10+-- looking through 20324 candidates of size 11+-- looking through 61034 candidates of size 12+-- looking through 184544 candidates of size 13+cannot conjure
test/model/eg/arith.out view
@@ -1,32 +1,32 @@ double :: Int -> Int -- testing 4 combinations of argument values--- looking through 3/7 candidates of size 1--- looking through 3/9 candidates of size 2--- looking through 5/11 candidates of size 3+-- looking through 3 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 5 candidates of size 3 double x = x + x add :: Int -> Int -> Int -- testing 4 combinations of argument values--- looking through 4/8 candidates of size 1--- looking through 0/12 candidates of size 2--- looking through 29/29 candidates of size 3+-- looking through 4 candidates of size 1+-- looking through 0 candidates of size 2+-- looking through 29 candidates of size 3 add x y = x + y square :: Int -> Int -- testing 3 combinations of argument values--- looking through 3/7 candidates of size 1--- looking through 3/9 candidates of size 2--- looking through 5/11 candidates of size 3+-- looking through 3 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 5 candidates of size 3 square x = x * x tnpo :: Int -> Int -- testing 3 combinations of argument values--- looking through 3/7 candidates of size 1--- looking through 3/9 candidates of size 2--- looking through 5/11 candidates of size 3--- looking through 20/30 candidates of size 4--- looking through 13/53 candidates of size 5--- looking through 97/123 candidates of size 6--- looking through 42/236 candidates of size 7+-- looking through 3 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 5 candidates of size 3+-- looking through 20 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 97 candidates of size 6+-- looking through 42 candidates of size 7 tnpo x = x + (x + (x + 1))
test/model/eg/bools.out view
@@ -1,44 +1,44 @@ and :: [Bool] -> Bool -- testing 14 combinations of argument values--- looking through 2/12 candidates of size 1--- looking through 3/12 candidates of size 2--- looking through 6/25 candidates of size 3--- looking through 6/48 candidates of size 4--- looking through 16/84 candidates of size 5--- looking through 41/185 candidates of size 6--- looking through 103/447 candidates of size 7--- looking through 278/1123 candidates of size 8--- looking through 752/2982 candidates of size 9+-- looking through 2 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 6 candidates of size 4+-- looking through 16 candidates of size 5+-- looking through 41 candidates of size 6+-- looking through 87 candidates of size 7+-- looking through 214 candidates of size 8+-- looking through 592 candidates of size 9 and ps = null ps || head ps && and (tail ps) or :: [Bool] -> Bool -- testing 14 combinations of argument values--- looking through 2/12 candidates of size 1--- looking through 3/12 candidates of size 2--- looking through 6/25 candidates of size 3--- looking through 6/48 candidates of size 4--- looking through 16/84 candidates of size 5--- looking through 41/185 candidates of size 6--- looking through 103/447 candidates of size 7--- looking through 278/1123 candidates of size 8--- looking through 752/2982 candidates of size 9--- looking through 1963/7993 candidates of size 10--- looking through 5427/21497 candidates of size 11+-- looking through 2 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 6 candidates of size 4+-- looking through 16 candidates of size 5+-- looking through 41 candidates of size 6+-- looking through 87 candidates of size 7+-- looking through 214 candidates of size 8+-- looking through 592 candidates of size 9+-- looking through 1503 candidates of size 10+-- looking through 3987 candidates of size 11 or ps = not (null ps || not (head ps || or (tail ps))) and :: [Bool] -> Bool -- testing 14 combinations of argument values--- looking through 2/13 candidates of size 1--- looking through 3/14 candidates of size 2--- looking through 6/31 candidates of size 3--- looking through 8/63 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 8 candidates of size 4 and ps = foldr (&&) True ps or :: [Bool] -> Bool -- testing 14 combinations of argument values--- looking through 2/13 candidates of size 1--- looking through 3/14 candidates of size 2--- looking through 6/31 candidates of size 3--- looking through 8/63 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 8 candidates of size 4 or ps = foldr (||) False ps
test/model/eg/factorial.out view
@@ -1,22 +1,22 @@ factorial :: Int -> Int -- testing 6 combinations of argument values--- looking through 2/6 candidates of size 1--- looking through 2/4 candidates of size 2--- looking through 0/6 candidates of size 3--- looking through 2/10 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 0 candidates of size 3+-- looking through 2 candidates of size 4 factorial n = product (enumFromTo 1 n) factorial :: Int -> Int -- testing 6 combinations of argument values--- looking through 3/9 candidates of size 1--- looking through 5/14 candidates of size 2--- looking through 8/26 candidates of size 3--- looking through 26/66 candidates of size 4--- looking through 59/180 candidates of size 5--- looking through 167/505 candidates of size 6--- looking through 581/1521 candidates of size 7--- looking through 1654/4809 candidates of size 8--- looking through 5736/15120 candidates of size 9--- looking through 17617/48943 candidates of size 10+-- looking through 3 candidates of size 1+-- looking through 5 candidates of size 2+-- looking through 8 candidates of size 3+-- looking through 26 candidates of size 4+-- looking through 59 candidates of size 5+-- looking through 167 candidates of size 6+-- looking through 581 candidates of size 7+-- looking through 1654 candidates of size 8+-- looking through 5736 candidates of size 9+-- looking through 17617 candidates of size 10 factorial n = if n == 0 then 1 else n * factorial (dec n)
test/model/eg/ints.out view
@@ -1,59 +1,59 @@ second :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3 second xs = head (tail xs) third :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4 third xs = head (tail (tail xs)) sum :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4--- looking through 13/33 candidates of size 5--- looking through 26/68 candidates of size 6--- looking through 63/143 candidates of size 7--- looking through 152/336 candidates of size 8--- looking through 358/783 candidates of size 9--- looking through 860/1835 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 26 candidates of size 6+-- looking through 59 candidates of size 7+-- looking through 140 candidates of size 8+-- looking through 326 candidates of size 9+-- looking through 776 candidates of size 10 sum xs = if null xs then 0 else head xs + sum (tail xs) product :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4--- looking through 13/33 candidates of size 5--- looking through 26/68 candidates of size 6--- looking through 63/143 candidates of size 7--- looking through 152/336 candidates of size 8--- looking through 358/783 candidates of size 9--- looking through 860/1835 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 26 candidates of size 6+-- looking through 59 candidates of size 7+-- looking through 140 candidates of size 8+-- looking through 326 candidates of size 9+-- looking through 776 candidates of size 10 product xs = if null xs then 1 else head xs * product (tail xs) sum :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/12 candidates of size 1--- looking through 2/10 candidates of size 2--- looking through 3/15 candidates of size 3--- looking through 8/26 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 8 candidates of size 4 sum xs = foldr (+) 0 xs product :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/12 candidates of size 1--- looking through 2/10 candidates of size 2--- looking through 3/15 candidates of size 3--- looking through 8/26 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 8 candidates of size 4 product xs = foldr (*) 1 xs
test/model/eg/list.out view
@@ -1,94 +1,94 @@ length :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/9 candidates of size 1--- looking through 1/5 candidates of size 2--- looking through 2/7 candidates of size 3--- looking through 3/12 candidates of size 4--- looking through 5/17 candidates of size 5--- looking through 11/30 candidates of size 6--- looking through 22/57 candidates of size 7--- looking through 51/119 candidates of size 8--- looking through 95/240 candidates of size 9+-- looking through 2 candidates of size 1+-- looking through 1 candidates of size 2+-- looking through 2 candidates of size 3+-- looking through 3 candidates of size 4+-- looking through 5 candidates of size 5+-- looking through 11 candidates of size 6+-- looking through 20 candidates of size 7+-- looking through 45 candidates of size 8+-- looking through 79 candidates of size 9 length xs = if null xs then 0 else 1 + length (tail xs) reverse :: [Int] -> [Int] -- testing 60 combinations of argument values--- looking through 2/10 candidates of size 1--- looking through 4/9 candidates of size 2--- looking through 9/23 candidates of size 3--- looking through 24/56 candidates of size 4--- looking through 65/153 candidates of size 5--- looking through 215/466 candidates of size 6--- looking through 673/1462 candidates of size 7--- looking through 2176/4680 candidates of size 8--- looking through 7126/15229 candidates of size 9--- looking through 23619/50202 candidates of size 10--- looking through 79162/167174 candidates of size 11+-- looking through 2 candidates of size 1+-- looking through 4 candidates of size 2+-- looking through 9 candidates of size 3+-- looking through 24 candidates of size 4+-- looking through 65 candidates of size 5+-- looking through 215 candidates of size 6+-- looking through 673 candidates of size 7+-- looking through 2174 candidates of size 8+-- looking through 7100 candidates of size 9+-- looking through 23503 candidates of size 10+-- looking through 78714 candidates of size 11 reverse xs = if null xs then xs else reverse (tail xs) ++ unit (head xs) sort :: [Int] -> [Int] -- testing 60 combinations of argument values--- looking through 2/9 candidates of size 1--- looking through 4/7 candidates of size 2--- looking through 6/18 candidates of size 3--- looking through 12/38 candidates of size 4--- looking through 31/81 candidates of size 5--- looking through 98/207 candidates of size 6--- looking through 287/576 candidates of size 7--- looking through 790/1661 candidates of size 8--- looking through 2192/4759 candidates of size 9--- looking through 6352/13661 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 4 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 12 candidates of size 4+-- looking through 31 candidates of size 5+-- looking through 98 candidates of size 6+-- looking through 287 candidates of size 7+-- looking through 790 candidates of size 8+-- looking through 2188 candidates of size 9+-- looking through 6290 candidates of size 10 sort xs = if null xs then xs else insert (head xs) (sort (tail xs)) (++) :: [Int] -> [Int] -> [Int] -- testing 60 combinations of argument values--- looking through 3/10 candidates of size 1--- looking through 3/11 candidates of size 2--- looking through 12/28 candidates of size 3--- looking through 39/81 candidates of size 4--- looking through 83/212 candidates of size 5--- looking through 290/623 candidates of size 6--- looking through 1013/2039 candidates of size 7--- looking through 3482/6732 candidates of size 8--- looking through 11207/22507 candidates of size 9--- looking through 36383/74650 candidates of size 10--- looking through 124785/250463 candidates of size 11+-- looking through 3 candidates of size 1+-- looking through 3 candidates of size 2+-- looking through 12 candidates of size 3+-- looking through 39 candidates of size 4+-- looking through 83 candidates of size 5+-- looking through 290 candidates of size 6+-- looking through 1013 candidates of size 7+-- looking through 3482 candidates of size 8+-- looking through 11171 candidates of size 9+-- looking through 36185 candidates of size 10+-- looking through 123417 candidates of size 11 xs ++ ys = if null xs then ys else head xs:(tail xs ++ ys) length :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/9 candidates of size 1--- looking through 1/4 candidates of size 2--- looking through 1/6 candidates of size 3--- looking through 4/13 candidates of size 4--- looking through 2/21 candidates of size 5--- looking through 10/45 candidates of size 6+-- looking through 2 candidates of size 1+-- looking through 1 candidates of size 2+-- looking through 1 candidates of size 3+-- looking through 4 candidates of size 4+-- looking through 2 candidates of size 5+-- looking through 10 candidates of size 6 length xs = foldr (const (1 +)) 0 xs reverse :: [Int] -> [Int] -- testing 60 combinations of argument values--- looking through 2/10 candidates of size 1--- looking through 2/6 candidates of size 2--- looking through 1/8 candidates of size 3--- looking through 5/14 candidates of size 4--- looking through 1/19 candidates of size 5--- looking through 17/43 candidates of size 6--- looking through 37/89 candidates of size 7+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 1 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 1 candidates of size 5+-- looking through 17 candidates of size 6+-- looking through 37 candidates of size 7 reverse xs = foldr (flip (++) . unit) [] xs sort :: [Int] -> [Int] -- testing 60 combinations of argument values--- looking through 2/7 candidates of size 1--- looking through 2/3 candidates of size 2--- looking through 0/2 candidates of size 3--- looking through 2/4 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 0 candidates of size 3+-- looking through 2 candidates of size 4 sort xs = foldr insert [] xs (++) :: [Int] -> [Int] -> [Int] -- testing 60 combinations of argument values--- looking through 3/8 candidates of size 1--- looking through 0/4 candidates of size 2--- looking through 9/12 candidates of size 3--- looking through 4/4 candidates of size 4+-- looking through 3 candidates of size 1+-- looking through 0 candidates of size 2+-- looking through 9 candidates of size 3+-- looking through 4 candidates of size 4 xs ++ ys = foldr (:) ys xs
test/model/eg/spec.out view
@@ -1,29 +1,29 @@ sum :: [Int] -> Int -- testing 3 combinations of argument values--- looking through 1/9 candidates of size 1--- looking through 2/5 candidates of size 2--- looking through 2/8 candidates of size 3--- looking through 2/10 candidates of size 4--- looking through 5/16 candidates of size 5--- looking through 10/29 candidates of size 6--- looking through 23/56 candidates of size 7--- looking through 46/114 candidates of size 8--- looking through 92/228 candidates of size 9--- looking through 189/465 candidates of size 10+-- looking through 1 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 2 candidates of size 3+-- looking through 2 candidates of size 4+-- looking through 5 candidates of size 5+-- looking through 10 candidates of size 6+-- looking through 19 candidates of size 7+-- looking through 34 candidates of size 8+-- looking through 64 candidates of size 9+-- looking through 129 candidates of size 10 sum xs = if null xs then 0 else head xs + sum (tail xs) (++) :: [Int] -> [Int] -> [Int] -- testing 3 combinations of argument values--- looking through 2/9 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 6/18 candidates of size 3--- looking through 18/42 candidates of size 4--- looking through 38/102 candidates of size 5--- looking through 110/262 candidates of size 6--- looking through 334/746 candidates of size 7--- looking through 1018/2170 candidates of size 8--- looking through 2966/6442 candidates of size 9--- looking through 8662/19142 candidates of size 10--- looking through 26166/57090 candidates of size 11+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 6 candidates of size 3+-- looking through 18 candidates of size 4+-- looking through 38 candidates of size 5+-- looking through 110 candidates of size 6+-- looking through 334 candidates of size 7+-- looking through 1018 candidates of size 8+-- looking through 2958 candidates of size 9+-- looking through 8614 candidates of size 10+-- looking through 25910 candidates of size 11 xs ++ ys = if null xs then ys else head xs:(tail xs ++ ys)
test/model/eg/tapps.out view
@@ -1,30 +1,30 @@ third :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4 third xs = head (tail (tail xs)) product :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/11 candidates of size 1--- looking through 2/8 candidates of size 2--- looking through 3/11 candidates of size 3--- looking through 5/18 candidates of size 4--- looking through 13/33 candidates of size 5--- looking through 26/68 candidates of size 6--- looking through 63/143 candidates of size 7--- looking through 152/336 candidates of size 8--- looking through 358/783 candidates of size 9--- looking through 860/1835 candidates of size 10+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 5 candidates of size 4+-- looking through 13 candidates of size 5+-- looking through 26 candidates of size 6+-- looking through 59 candidates of size 7+-- looking through 140 candidates of size 8+-- looking through 326 candidates of size 9+-- looking through 776 candidates of size 10 product xs = if null xs then 1 else head xs * product (tail xs) product :: [Int] -> Int -- testing 60 combinations of argument values--- looking through 2/12 candidates of size 1--- looking through 2/10 candidates of size 2--- looking through 3/15 candidates of size 3--- looking through 8/26 candidates of size 4+-- looking through 2 candidates of size 1+-- looking through 2 candidates of size 2+-- looking through 3 candidates of size 3+-- looking through 8 candidates of size 4 product xs = foldr (*) 1 xs