Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor wibbles.

  • Loading branch information...
commit 7e121eb6eb5b540771876b807233903195059064 1 parent 25d6ce3
@leepike authored
View
45 TODO.md
@@ -38,8 +38,29 @@ get their constructors, too.
* Web view for large data (like Yav's thing for type nats)?
-* Would I benefit from using a zipper for traversal? I suspect not since I am
- really don't a fold. (Oleg Kiselyov, 27 Apr 2005, haskell\@, "Zipper as a delimited continuation")
+* Would I benefit from using a zipper for traversal? I suspect not since I
+ really don't fold. (Oleg Kiselyov, 27 Apr 2005, haskell\@, "Zipper as a delimited continuation")
+
+* Try out SubTypes instances for Map a b and try an algebric type inside of
+ lists (maybe Forest Foo).
+
+* Go through Reddit comments: (in refs/)
+
+* Why do things crap out with HeapPP sometimes in shrinking? Profile.
+
+* Try to fix/simplify definition of showForest.
+
+* Probably, list/map [a] should be a baseType if a is a baseType and not
+ otherwise.
+
+* Include instance for Data.Map in SubType instances? Argument for not:
+ QuickCheck doesn't include them as basic instances...
+
+* Test () SubType method.
+
+* Refactor so we only getAtIdx (which is expensive!) once per pass.
+
+* Pass around stdGen so that more code is pure.
Won't Do / Can't Do
-----------------------------------------------
@@ -50,17 +71,25 @@ Won't Do / Can't Do
seems like wasted time. In any event, there's commented out code in
smartShrink (in Reduce) that will do this.
-* Make sure that printing, etc. doesn't depend on subTypes. Just want that to
- do with replacing values during testing. I'm not sure I can do this
- independently of SubT.
-
- * I think I need something like this.
-
* I don't think I can make a generic instance for the arbitrary method. This is
because I don't take a value and apply a function to it. Rather, I want to
generate a new value. But Generics expects to have some sort of
representation of the data you're manipulating.
+* QuickCheck uses a clever trick with typeclasses that allows them to generate
+ and test functions in the [Property
+ module](http://hackage.haskell.org/packages/archive/QuickCheck/2.5/doc/html/src/Test-QuickCheck-Property.html#exhaustive).
+ I was thinking it might be nice to follow their approach with SmartCheck, but
+ there are a few problems/lack of motivation:
+
+ * SmartCheck addresses the problem of getting complex counterexamples.
+ Usually, we imagine there's one complex datatype, and maybe some Ints,
+ Chars, etc. that we also want to randomly generate and test. In this case,
+ it makes sense to focus on the one.
+
+ * With QuickCheck, there are essentially two passes: (1) make some arbitrary
+ values and test them, and (2) shrink the values.
+
Done
-----------------------------------------------
* ~~Rename examples/Test to examples/MutRecData~~
View
5 examples/Div0.hs
@@ -60,6 +60,11 @@ divSubTerms (D m0 m1) = divSubTerms m0 && divSubTerms m1
-- div0 (A _ _) = property False
-- div0 _ = property True
+-- test_prop m = case eval m of
+-- Nothing -> True
+-- Just i -> i < 5
+
+
divTest :: IO ()
divTest = smartCheck args div_prop
where
View
7 src/Test/SmartCheck/DataToTree.hs
@@ -60,8 +60,9 @@ levelLength n t = sum $ map (levelLength (n-1)) (subForest t)
-- | Get the tree at idx in a forest. Nothing if the index is out-of-bounds.
getIdxForest :: Forest a -> Idx -> Maybe (Tree a)
-getIdxForest forest (Idx (0::Int) n) =
- if length forest > n then Just (forest !! n) else Nothing
+getIdxForest forest (Idx (0 :: Int) n) =
+ if length forest > n then Just (forest !! n)
+ else Nothing
getIdxForest forest idx =
-- Should be a single Just x in the list, holding the value.
listToMaybe . catMaybes . snd $ acc
@@ -117,7 +118,7 @@ forestReplaceChildren = sub Children
sub :: SubStrat -> Forest a -> Idx -> a -> Forest a
-- on right level, and we'll assume correct subtree.
-sub strat forest (Idx (0::Int) n) a =
+sub strat forest (Idx (0 :: Int) n) a =
snd $ mapAccumL f 0 forest
where
f i node | i == n = ( i+1, news )
View
2  src/Test/SmartCheck/Extrapolate.hs
@@ -58,7 +58,7 @@ extrapolate args d origProp ds = do
-- None of the tries satisfy prop (but something passed the precondition).
-- Prevent recurring down this tree, since we can generalize.
FailedProp -> nextIter (forestReplaceChildren forest' idx False)
- (idx : idxs)
+ (idx : idxs)
FailedPreCond -> nextIter forest' idxs
Result _ -> nextIter forest' idxs
where
View
2  src/Test/SmartCheck/Render.hs
@@ -54,7 +54,7 @@ renderWithVars format d idxs = do
(putStrLn $ "forall " ++ kind ++ " "
++ unwords (take len vs) ++ ":")
- vars str = map (\(x,i) -> x ++ show i) (zip (repeat str) [0::Int ..])
+ vars str = map (\(x,i) -> x ++ show i) (zip (repeat str) [0::Integer ..])
valVars = vars "x"
constrVars = vars "C"
Please sign in to comment.
Something went wrong with that request. Please try again.