ChasingBottoms 1.3.0.9 → 1.3.0.10
raw patch · 11 files changed
+69/−58 lines, 11 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- ChasingBottoms.cabal +57/−46
- LICENCE +1/−1
- Test/ChasingBottoms.hs +1/−1
- Test/ChasingBottoms/Approx.hs +1/−1
- Test/ChasingBottoms/ApproxShow.hs +1/−1
- Test/ChasingBottoms/ContinuousFunctions.hs +1/−1
- Test/ChasingBottoms/IsBottom.hs +1/−1
- Test/ChasingBottoms/IsType.hs +1/−1
- Test/ChasingBottoms/Nat.hs +1/−1
- Test/ChasingBottoms/SemanticOrd.hs +3/−3
- Test/ChasingBottoms/TimeOut.hs +1/−1
ChasingBottoms.cabal view
@@ -1,8 +1,8 @@ name: ChasingBottoms-version: 1.3.0.9+version: 1.3.0.10 license: MIT license-file: LICENCE-copyright: Copyright (c) Nils Anders Danielsson 2004-2014.+copyright: Copyright (c) Nils Anders Danielsson 2004-2015. author: Nils Anders Danielsson maintainer: http://www.cse.chalmers.se/~nad/ synopsis: For testing partial and infinite values.@@ -20,35 +20,47 @@ . Testing explicitly for bottoms: .- [@> isBottom (head [\])@] @True@+ >> isBottom (head [])+ >True .- [@> isBottom bottom@] @True@+ >> isBottom bottom+ >True .- [@> isBottom (\\_ -> bottom)@] @False@+ >> isBottom (\_ -> bottom)+ >False .- [@> isBottom (bottom, bottom)@] @False@+ >> isBottom (bottom, bottom)+ >False . Comparing finite, partial values: .- [@> ((bottom, 3) :: (Bool, Int)) ==! (bottom, 2+5-4)@] @True@+ >> ((bottom, 3) :: (Bool, Int)) ==! (bottom, 2+5-4)+ >True .- [@> ((bottom, bottom) :: (Bool, Int)) <! (bottom, 8)@] @True@+ >> ((bottom, bottom) :: (Bool, Int)) <! (bottom, 8)+ >True . Showing partial and infinite values (@\\\/!@ is join and @\/\\!@ is meet): .- [@> approxShow 4 $ (True, bottom) \\\/! (bottom, \'b\')@] @\"Just (True, \'b\')\"@+ >> approxShow 4 $ (True, bottom) \/! (bottom, 'b')+ >"Just (True, 'b')" .- [@> approxShow 4 $ (True, bottom) \/\\! (bottom, \'b\')@] @\"(_|_, _|_)\"@+ >> approxShow 4 $ (True, bottom) /\! (bottom, 'b')+ >"(_|_, _|_)" .- [@> approxShow 4 $ ([1..\] :: [Int\])@] @\"[1, 2, 3, _\"@+ >> approxShow 4 $ ([1..] :: [Int])+ >"[1, 2, 3, _" .- [@> approxShow 4 $ (cycle [bottom\] :: [Bool\])@] @\"[_|_, _|_, _|_, _\"@+ >> approxShow 4 $ (cycle [bottom] :: [Bool])+ >"[_|_, _|_, _|_, _" . Approximately comparing infinite, partial values: .- [@> approx 100 [2,4..\] ==! approx 100 (filter even [1..\] :: [Int\])@] @True@+ >> approx 100 [2,4..] ==! approx 100 (filter even [1..] :: [Int])+ >True .- [@> approx 100 [2,4..\] \/=! approx 100 (filter even [bottom..\] :: [Int\])@] @True@+ >> approx 100 [2,4..] /=! approx 100 (filter even [bottom..] :: [Int])+ >True . The code above relies on the fact that @bottom@, just as @error \"...\"@, @undefined@ and pattern match failures, yield@@ -56,38 +68,43 @@ computations, such as the following example, and then it can be nice to be able to apply a time-out: .- [@> timeOut' 1 (reverse [1..5\])@] @Value [5,4,3,2,1]@+ >> timeOut' 1 (reverse [1..5])+ >Value [5,4,3,2,1] .- [@> timeOut' 1 (reverse [1..\])@] @NonTermination@+ >> timeOut' 1 (reverse [1..])+ >NonTermination . The time-out functionality can be used to treat \"slow\" computations as bottoms: .- [@> let tweak = Tweak { approxDepth = Just 5, timeOutLimit = Just 2 }@]- .- [@> semanticEq tweak (reverse [1..\], [1..\]) (bottom :: [Int\], [1..\] :: [Int\])@] @True@- .- [@> let tweak = noTweak { timeOutLimit = Just 2 }@]+ @+ > let tweak = Tweak { approxDepth = Just 5, timeOutLimit = Just 2 }+ > semanticEq tweak (reverse [1..], [1..]) (bottom :: [Int], [1..] :: [Int])+ True+ @ .- [@> semanticJoin tweak (reverse [1..\], True) ([\] :: [Int\], bottom)@] @Just ([],True)@+ @+ > let tweak = noTweak { timeOutLimit = Just 2 }+ > semanticJoin tweak (reverse [1..], True) ([] :: [Int], bottom)+ Just ([],True)+ @ . This can of course be dangerous: .- [@> let tweak = noTweak { timeOutLimit = Just 0 }@]- .- [@> semanticEq tweak (reverse [1..100000000\]) (bottom :: [Integer\])@] @True@+ @+ > let tweak = noTweak { timeOutLimit = Just 0 }+ > semanticEq tweak (reverse [1..100000000]) (bottom :: [Integer])+ True+ @ . Timeouts can also be applied to @IO@ computations: .- [@> let primes = unfoldr (\\(x:xs) -> Just (x, filter ((\/= 0) . (\`mod\` x)) xs)) [2..\]@]- .- [@> timeOutMicro 100 (print $ filter ((== 1) . (\`mod\` 83)) primes)@] @[167,499,9NonTermination@- .- [@> timeOutMicro 100 (print $ take 6 $ filter ((== 1) . (\`mod\` 83)) primes)@] @[167,499,997,1163,1993NonTermination@- .- [@> timeOutMicro 100 (print $ take 6 $ filter ((== 1) . (\`mod\` 83)) primes)@] @[167,499,997,1163,1993,2657]@- .- [@ @] @Value ()@+ >> let primes () = unfoldr (\(x:xs) -> Just (x, filter ((/= 0) . (`mod` x)) xs)) [2..]+ >> timeOutMicro 100 (print $ primes ())+ >[2,NonTermination+ >> timeOutMicro 10000 (print $ take 10 $ primes ())+ >[2,3,5,7,11,13,17,19,23,29]+ >Value () . For the underlying theory and a larger example involving use of QuickCheck, see the article \"Chasing Bottoms, A Case Study in Program@@ -100,8 +117,8 @@ the rest requires @Data.Generics@; @isBottom@ only requires exceptions, though. category: Testing-tested-with: GHC == 7.6.3-cabal-version: >= 1.8+tested-with: GHC == 7.8.4+cabal-version: >= 1.9.2 build-type: Simple source-repository head@@ -123,19 +140,13 @@ build-depends: QuickCheck >= 2.1 && < 2.8, mtl >= 1.1 && < 2.3,- base >= 4.0 && < 4.8,+ base >= 4.0 && < 4.9, containers >= 0.3 && < 0.6, random >= 1.0 && < 1.2, syb >= 0.1.0.2 && < 0.5 -flag build-tests- description: Build the test suite.- default: False- manual: True--executable ChasingBottomsTestSuite- if !flag(build-tests)- buildable: False+test-suite ChasingBottomsTestSuite+ type: exitcode-stdio-1.0 main-is: Test/ChasingBottoms/Tests.hs @@ -152,7 +163,7 @@ build-depends: QuickCheck >= 2.1 && < 2.8, mtl >= 1.1 && < 2.3,- base >= 4.0 && < 4.8,+ base >= 4.0 && < 4.9, containers >= 0.3 && < 0.6, random >= 1.0 && < 1.2, syb >= 0.1.0.2 && < 0.5,
LICENCE view
@@ -1,7 +1,7 @@ I have chosen to distribute this library under the MIT/Expat licence: --------------------------------------------------------------------- -Copyright (c) 2004-2013 Nils Anders Danielsson+Copyright (c) 2004-2015 Nils Anders Danielsson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
Test/ChasingBottoms.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Test.ChasingBottoms--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/Approx.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Test.ChasingBottoms.Approx--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/ApproxShow.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Test.ChasingBottoms.ApproxShow--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/ContinuousFunctions.hs view
@@ -12,7 +12,7 @@ -- | -- Module : Test.ChasingBottoms.ContinuousFunctions--- Copyright : (c) Nils Anders Danielsson 2005-2014+-- Copyright : (c) Nils Anders Danielsson 2005-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/IsBottom.hs view
@@ -5,7 +5,7 @@ -- | -- Module : Test.ChasingBottoms.IsBottom--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/IsType.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Test.ChasingBottoms.IsType--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/Nat.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Test.ChasingBottoms.Nat--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/
Test/ChasingBottoms/SemanticOrd.hs view
@@ -3,7 +3,7 @@ -- | -- Module : Test.ChasingBottoms.SemanticOrd--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/@@ -137,8 +137,8 @@ ------------------------------------------------------------------------ -type Rel' = (Data a, Data b) => Tweak -> a -> b -> Bool-type Rel = (Data a, Data b) => a -> b -> Bool+type Rel' = forall a b. (Data a, Data b) => Tweak -> a -> b -> Bool+type Rel = forall a b. (Data a, Data b) => a -> b -> Bool semanticEq', semanticLE' :: Rel'
Test/ChasingBottoms/TimeOut.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Test.ChasingBottoms.TimeOut--- Copyright : (c) Nils Anders Danielsson 2004-2014+-- Copyright : (c) Nils Anders Danielsson 2004-2015 -- License : See the file LICENCE. -- -- Maintainer : http://www.cse.chalmers.se/~nad/