less-arbitrary 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+61/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Test.LessArbitrary.Cost: Cost :: Int -> Cost
+ Test.LessArbitrary.Cost: instance GHC.Classes.Eq Test.LessArbitrary.Cost.Cost
+ Test.LessArbitrary.Cost: instance GHC.Classes.Ord Test.LessArbitrary.Cost.Cost
+ Test.LessArbitrary.Cost: instance GHC.Enum.Bounded Test.LessArbitrary.Cost.Cost
+ Test.LessArbitrary.Cost: instance GHC.Enum.Enum Test.LessArbitrary.Cost.Cost
+ Test.LessArbitrary.Cost: instance GHC.Num.Num Test.LessArbitrary.Cost.Cost
+ Test.LessArbitrary.Cost: newtype Cost
Files
- CHANGELOG.md +7/−0
- README.md +51/−9
- less-arbitrary.cabal +3/−3
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Revision history for less-arbitrary ++0.1.2.0 -- 2020-12-13+* Exposed `Test.LessArbitrary.Cost` module.++0.1.1.0 -- 2020-12-13+* Moved `Cost` to `Test.LessArbitrary.Cost` module.+ 0.1.0.2 -- 2020-10-17 * Fixed the package metadata.
README.md view
@@ -1,11 +1,53 @@-To build this you need:-* pandoc-* dejavu-sans and Arial fonts installed- (the latter from msttcorefonts package or similar)-* xelatex with standard science article packages+# Introduction++This is way to write arbitrary instances+that should terminate in linear time with respect to budget,+or throw an error instead when they go over budget+and it is unclear how to terminate data structure.++## Usage++Just try:+```+import Test.LessArbitrary++data MyDataType = ...+ deriving (Generic)++instance LessArbitrary MyDataType+instance Arbitrary MyDataType where+ arbitrary = fasterArbitrary+```++## How it is done?++It is simply putting a monad that tracks the cost of constructors generated so far,+and throw an error when it goes too far. Goes for mutually recursive data structures+with at least one terminating constructor available.++Not to be used on non-terminating lazy data structures.++# Documentation build++To build detailed article on implementation, you would need:++* `pandoc`+* `xelatex` with standard science article packages - easiest to get as MacTeX on Mac - `apt-get install -y texlive-recommended` on Ubuntu-* Stephen Diehl category theory diagrams:- - git@github.com:sdiehl/cats.git-* markdown-unlit-* pandoc-hide-codeblocks+* `pandoc-hide-codeblocks` filter to hide unnecessary code blocks (optional)++# Hacker's guide++Entire Haskell code is in literate markdown `less-arbitrary.md`.+In order to work with it you will need `entangled` literate programming daemon+that synchronizes source files with the literate source.++It is bidirectional.++```+git clone https://github.com/entangled/entangled --branch develop+cd entangled;+cabal install # or stack install+entangled daemon+```
less-arbitrary.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 2784cd23f761bc388cdc69ce5a87b11f9d38fa3598fdf1b60aabd3c87fd65ffa+-- hash: dd5540dd675e80ceab8bd98fe62c04c526f71fc96ebd88be2853fa32d496dea2 name: less-arbitrary-version: 0.1.1.0+version: 0.1.2.0 synopsis: Linear time testing with variant of Arbitrary class that always terminates. description: Ever found non-terminating Arbitrary instance? Ever wondered what would be a runtime cost of particular Arbitrary instance?@@ -39,8 +39,8 @@ library exposed-modules: Test.LessArbitrary- other-modules: Test.LessArbitrary.Cost+ other-modules: Paths_less_arbitrary hs-source-dirs: src