summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-haskell/chasingbottoms/metadata.xml
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-haskell/chasingbottoms/metadata.xml')
-rw-r--r--dev-haskell/chasingbottoms/metadata.xml99
1 files changed, 99 insertions, 0 deletions
diff --git a/dev-haskell/chasingbottoms/metadata.xml b/dev-haskell/chasingbottoms/metadata.xml
new file mode 100644
index 000000000000..bf0a95f2eed0
--- /dev/null
+++ b/dev-haskell/chasingbottoms/metadata.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>haskell</herd>
+ <longdescription>
+ Do you ever feel the need to test code involving bottoms (e.g. calls to
+ the @error@ function), or code involving infinite values? Then this
+ library could be useful for you.
+
+ It is usually easy to get a grip on bottoms by showing a value and
+ waiting to see how much gets printed before the first exception is
+ encountered. However, that quickly gets tiresome and is hard to automate
+ using e.g. QuickCheck
+ (&lt;http://www.cse.chalmers.se/~rjmh/QuickCheck/&gt;). With this library you
+ can do the tests as simply as the following examples show.
+
+ Testing explicitly for bottoms:
+
+ [@&gt; isBottom (head [\])@] @True@
+
+ [@&gt; isBottom bottom@] @True@
+
+ [@&gt; isBottom (\\_ -&gt; bottom)@] @False@
+
+ [@&gt; isBottom (bottom, bottom)@] @False@
+
+ Comparing finite, partial values:
+
+ [@&gt; ((bottom, 3) :: (Bool, Int)) ==! (bottom, 2+5-4)@] @True@
+
+ [@&gt; ((bottom, bottom) :: (Bool, Int)) &lt;! (bottom, 8)@] @True@
+
+ Showing partial and infinite values (@\\\/!@ is join and @\/\\!@ is meet):
+
+ [@&gt; approxShow 4 $ (True, bottom) \\\/! (bottom, \&#39;b\&#39;)@] @\&quot;Just (True, \&#39;b\&#39;)\&quot;@
+
+ [@&gt; approxShow 4 $ (True, bottom) \/\\! (bottom, \&#39;b\&#39;)@] @\&quot;(_|_, _|_)\&quot;@
+
+ [@&gt; approxShow 4 $ ([1..\] :: [Int\])@] @\&quot;[1, 2, 3, _\&quot;@
+
+ [@&gt; approxShow 4 $ (cycle [bottom\] :: [Bool\])@] @\&quot;[_|_, _|_, _|_, _\&quot;@
+
+ Approximately comparing infinite, partial values:
+
+ [@&gt; approx 100 [2,4..\] ==! approx 100 (filter even [1..\] :: [Int\])@] @True@
+
+ [@&gt; approx 100 [2,4..\] \/=! approx 100 (filter even [bottom..\] :: [Int\])@] @True@
+
+ The code above relies on the fact that @bottom@, just as @error
+ \&quot;...\&quot;@, @undefined@ and pattern match failures, yield
+ exceptions. Sometimes we are dealing with properly non-terminating
+ computations, such as the following example, and then it can be nice to
+ be able to apply a time-out:
+
+ [@&gt; timeOut&#39; 1 (reverse [1..5\])@] @Value [5,4,3,2,1]@
+
+ [@&gt; timeOut&#39; 1 (reverse [1..\])@] @NonTermination@
+
+ The time-out functionality can be used to treat \&quot;slow\&quot; computations as
+ bottoms:
+
+ [@&gt; let tweak = Tweak &amp;#x7b; approxDepth = Just 5, timeOutLimit = Just 2 &amp;#x7d;@]
+
+ [@&gt; semanticEq tweak (reverse [1..\], [1..\]) (bottom :: [Int\], [1..\] :: [Int\])@] @True@
+
+ [@&gt; let tweak = noTweak &amp;#x7b; timeOutLimit = Just 2 &amp;#x7d;@]
+
+ [@&gt; semanticJoin tweak (reverse [1..\], True) ([\] :: [Int\], bottom)@] @Just ([],True)@
+
+ This can of course be dangerous:
+
+ [@&gt; let tweak = noTweak &amp;#x7b; timeOutLimit = Just 0 &amp;#x7d;@]
+
+ [@&gt; semanticEq tweak (reverse [1..100000000\]) (bottom :: [Integer\])@] @True@
+
+ Timeouts can also be applied to @IO@ computations:
+
+ [@&gt; let primes = unfoldr (\\(x:xs) -&gt; Just (x, filter ((\/= 0) . (\`mod\` x)) xs)) [2..\]@]
+
+ [@&gt; timeOutMicro 100 (print $ filter ((== 1) . (\`mod\` 83)) primes)@] @[167,499,9NonTermination@
+
+ [@&gt; timeOutMicro 100 (print $ take 6 $ filter ((== 1) . (\`mod\` 83)) primes)@] @[167,499,997,1163,1993NonTermination@
+
+ [@&gt; timeOutMicro 100 (print $ take 6 $ filter ((== 1) . (\`mod\` 83)) primes)@] @[167,499,997,1163,1993,2657]@
+
+ [@ @] @Value ()@
+
+ For the underlying theory and a larger example involving use of
+ QuickCheck, see the article \&quot;Chasing Bottoms, A Case Study in Program
+ Verification in the Presence of Partial and Infinite Values\&quot;
+ (&lt;http://www.cse.chalmers.se/~nad/publications/danielsson-jansson-mpc2004.html&gt;).
+
+ The code has been tested using GHC. Most parts can probably be
+ ported to other Haskell compilers, but this would require some work.
+ The @TimeOut@ functions require preemptive scheduling, and most of
+ the rest requires @Data.Generics@; @isBottom@ only requires
+ exceptions, though.
+ </longdescription>
+</pkgmetadata>