Skip to content

Commit

Permalink
Genvalidity 1.0.0.0
Browse files Browse the repository at this point in the history
* Removed Relative Validity
* Changed the default implementation of GenValid to use
  genValidStructurally and shrinkValidStructurally
* Removed GenUnchecked
* Removed GenInvalid
  • Loading branch information
Tom Sydney Kerckhove committed Nov 20, 2021
1 parent f5e5d69 commit 7d959b5
Show file tree
Hide file tree
Showing 343 changed files with 1,448 additions and 6,443 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
- ubuntu-latest
- macos-latest
attribute:
- lts-13_19
- lts-14_23
- lts-15_03
- lts-16_11
- release
- pre-commit-check
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016-2021 Tom Sydney Kerckhove

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
74 changes: 4 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,5 @@
# Validity and validity-based testing

[![Build Status](https://travis-ci.org/NorfairKing/validity.svg?branch=master)](https://travis-ci.org/NorfairKing/validity)

| Package | Hackage | Stackage |
|---|---|---|
| validity | [![Hackage](https://img.shields.io/hackage/v/validity.svg)](https://hackage.haskell.org/package/validity) | [![Stackage](https://www.stackage.org/package/validity/badge/lts)](https://www.stackage.org/package/validity) |
| validity-aeson | [![Hackage](https://img.shields.io/hackage/v/validity-aeson.svg)](https://hackage.haskell.org/package/validity-aeson) | [![Stackage](https://www.stackage.org/package/validity-aeson/badge/lts)](https://www.stackage.org/package/validity-aeson) |
| validity-bytestring | [![Hackage](https://img.shields.io/hackage/v/validity-bytestring.svg)](https://hackage.haskell.org/package/validity-bytestring) | [![Stackage](https://www.stackage.org/package/validity-bytestring/badge/lts)](https://www.stackage.org/package/validity-bytestring) |
| validity-containers | [![Hackage](https://img.shields.io/hackage/v/validity-containers.svg)](https://hackage.haskell.org/package/validity-containers) | [![Stackage](https://www.stackage.org/package/validity-containers/badge/lts)](https://www.stackage.org/package/validity-containers) |
| validity-path | [![Hackage](https://img.shields.io/hackage/v/validity-path.svg)](https://hackage.haskell.org/package/validity-path) | [![Stackage](https://www.stackage.org/package/validity-path/badge/lts)](https://www.stackage.org/package/validity-path) |
| validity-persistent | [![Hackage](https://img.shields.io/hackage/v/validity-persistent.svg)](https://hackage.haskell.org/package/validity-persistent) | [![Stackage](https://www.stackage.org/package/validity-persistent/badge/lts)](https://www.stackage.org/package/validity-persistent) |
| validity-primitive | [![Hackage](https://img.shields.io/hackage/v/validity-primitive.svg)](https://hackage.haskell.org/package/validity-primitive) | [![Stackage](https://www.stackage.org/package/validity-primitive/badge/lts)](https://www.stackage.org/package/validity-primitive) |
| validity-scientific | [![Hackage](https://img.shields.io/hackage/v/validity-scientific.svg)](https://hackage.haskell.org/package/validity-scientific) | [![Stackage](https://www.stackage.org/package/validity-scientific/badge/lts)](https://www.stackage.org/package/validity-scientific) |
| validity-text | [![Hackage](https://img.shields.io/hackage/v/validity-text.svg)](https://hackage.haskell.org/package/validity-text) | [![Stackage](https://www.stackage.org/package/validity-text/badge/lts)](https://www.stackage.org/package/validity-text) |
| validity-time | [![Hackage](https://img.shields.io/hackage/v/validity-time.svg)](https://hackage.haskell.org/package/validity-time) | [![Stackage](https://www.stackage.org/package/validity-time/badge/lts)](https://www.stackage.org/package/validity-time) |
| validity-unordered-containers | [![Hackage](https://img.shields.io/hackage/v/validity-unordered-containers.svg)](https://hackage.haskell.org/package/validity-unordered-containers) | [![Stackage](https://www.stackage.org/package/validity-unordered-containers/badge/lts)](https://www.stackage.org/package/validity-unordered-containers) |
| validity-uuid | [![Hackage](https://img.shields.io/hackage/v/validity-uuid.svg)](https://hackage.haskell.org/package/validity-uuid) | [![Stackage](https://www.stackage.org/package/validity-uuid/badge/lts)](https://www.stackage.org/package/validity-uuid) |
| validity-vector | [![Hackage](https://img.shields.io/hackage/v/validity-vector.svg)](https://hackage.haskell.org/package/validity-vector) | [![Stackage](https://www.stackage.org/package/validity-vector/badge/lts)](https://www.stackage.org/package/validity-vector) |
| genvalidity | [![Hackage](https://img.shields.io/hackage/v/genvalidity.svg)](https://hackage.haskell.org/package/genvalidity) | [![Stackage](https://www.stackage.org/package/genvalidity/badge/lts)](https://www.stackage.org/package/genvalidity) |
| genvalidity-aeson | [![Hackage](https://img.shields.io/hackage/v/genvalidity-aeson.svg)](https://hackage.haskell.org/package/genvalidity-aeson) | [![Stackage](https://www.stackage.org/package/genvalidity-aeson/badge/lts)](https://www.stackage.org/package/genvalidity-aeson) |
| genvalidity-bytestring | [![Hackage](https://img.shields.io/hackage/v/genvalidity-bytestring.svg)](https://hackage.haskell.org/package/genvalidity-bytestring) | [![Stackage](https://www.stackage.org/package/genvalidity-bytestring/badge/lts)](https://www.stackage.org/package/genvalidity-bytestring) |
| genvalidity-containers | [![Hackage](https://img.shields.io/hackage/v/genvalidity-containers.svg)](https://hackage.haskell.org/package/genvalidity-containers) | [![Stackage](https://www.stackage.org/package/genvalidity-containers/badge/lts)](https://www.stackage.org/package/genvalidity-containers) |
| genvalidity-criterion | [![Hackage](https://img.shields.io/hackage/v/genvalidity-criterion.svg)](https://hackage.haskell.org/package/genvalidity-criterion) | [![Stackage](https://www.stackage.org/package/genvalidity-criterion/badge/lts)](https://www.stackage.org/package/genvalidity-criterion) |
| genvalidity-path | [![Hackage](https://img.shields.io/hackage/v/genvalidity-path.svg)](https://hackage.haskell.org/package/genvalidity-path) | [![Stackage](https://www.stackage.org/package/genvalidity-path/badge/lts)](https://www.stackage.org/package/genvalidity-path) |
| genvalidity-persistent | [![Hackage](https://img.shields.io/hackage/v/genvalidity-persistent.svg)](https://hackage.haskell.org/package/genvalidity-persistent) | [![Stackage](https://www.stackage.org/package/genvalidity-persistent/badge/lts)](https://www.stackage.org/package/genvalidity-persistent) |
| genvalidity-property | [![Hackage](https://img.shields.io/hackage/v/genvalidity-property.svg)](https://hackage.haskell.org/package/genvalidity-property) | [![Stackage](https://www.stackage.org/package/genvalidity-property/badge/lts)](https://www.stackage.org/package/genvalidity-property) |
| genvalidity-scientific | [![Hackage](https://img.shields.io/hackage/v/genvalidity-scientific.svg)](https://hackage.haskell.org/package/genvalidity-scientific) | [![Stackage](https://www.stackage.org/package/genvalidity-scientific/badge/lts)](https://www.stackage.org/package/genvalidity-scientific) |
| genvalidity-text | [![Hackage](https://img.shields.io/hackage/v/genvalidity-text.svg)](https://hackage.haskell.org/package/genvalidity-text) | [![Stackage](https://www.stackage.org/package/genvalidity-text/badge/lts)](https://www.stackage.org/package/genvalidity-text) |
| genvalidity-time | [![Hackage](https://img.shields.io/hackage/v/genvalidity-time.svg)](https://hackage.haskell.org/package/genvalidity-time) | [![Stackage](https://www.stackage.org/package/genvalidity-time/badge/lts)](https://www.stackage.org/package/genvalidity-time) |
| genvalidity-unordered-containers | [![Hackage](https://img.shields.io/hackage/v/genvalidity-unordered-containers.svg)](https://hackage.haskell.org/package/genvalidity-unordered-containers) | [![Stackage](https://www.stackage.org/package/genvalidity-unordered-containers/badge/lts)](https://www.stackage.org/package/genvalidity-unordered-containers) |
| genvalidity-uuid | [![Hackage](https://img.shields.io/hackage/v/genvalidity-uuid.svg)](https://hackage.haskell.org/package/genvalidity-uuid) | [![Stackage](https://www.stackage.org/package/genvalidity-uuid/badge/lts)](https://www.stackage.org/package/genvalidity-uuid) |
| genvalidity-vector | [![Hackage](https://img.shields.io/hackage/v/genvalidity-vector.svg)](https://hackage.haskell.org/package/genvalidity-vector) | [![Stackage](https://www.stackage.org/package/genvalidity-vector/badge/lts)](https://www.stackage.org/package/genvalidity-vector) |
| genvalidity-hspec | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec.svg)](https://hackage.haskell.org/package/genvalidity-hspec) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec/badge/lts)](https://www.stackage.org/package/genvalidity-hspec) |
| genvalidity-hspec-aeson | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec-aeson.svg)](https://hackage.haskell.org/package/genvalidity-hspec-aeson) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec-aeson/badge/lts)](https://www.stackage.org/package/genvalidity-hspec-aeson) |
| genvalidity-hspec-binary | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec-binary.svg)](https://hackage.haskell.org/package/genvalidity-hspec-binary) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec-binary/badge/lts)](https://www.stackage.org/package/genvalidity-hspec-binary) |
| genvalidity-hspec-cereal | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec-cereal.svg)](https://hackage.haskell.org/package/genvalidity-hspec-cereal) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec-cereal/badge/lts)](https://www.stackage.org/package/genvalidity-hspec-cereal) |
| genvalidity-hspec-hashable | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec-hashable.svg)](https://hackage.haskell.org/package/genvalidity-hspec-hashable) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec-hashable/badge/lts)](https://www.stackage.org/package/genvalidity-hspec-hashable) |
| genvalidity-hspec-persistent | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec-persistent.svg)](https://hackage.haskell.org/package/genvalidity-hspec-persistent) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec-persistent/badge/lts)](https://www.stackage.org/package/genvalidity-hspec-persistent) |
| genvalidity-hspec-optics | [![Hackage](https://img.shields.io/hackage/v/genvalidity-hspec-optics.svg)](https://hackage.haskell.org/package/genvalidity-hspec-optics) | [![Stackage](https://www.stackage.org/package/genvalidity-hspec-optics/badge/lts)](https://www.stackage.org/package/genvalidity-hspec-optics) |
| genvalidity-sydtest | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest.svg)](https://hackage.haskell.org/package/genvalidity-sydtest) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest) |
| genvalidity-sydtest-aeson | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest-aeson.svg)](https://hackage.haskell.org/package/genvalidity-sydtest-aeson) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest-aeson/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest-aeson) |
| genvalidity-sydtest-binary | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest-binary.svg)](https://hackage.haskell.org/package/genvalidity-sydtest-binary) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest-binary/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest-binary) |
| genvalidity-sydtest-cereal | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest-cereal.svg)](https://hackage.haskell.org/package/genvalidity-sydtest-cereal) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest-cereal/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest-cereal) |
| genvalidity-sydtest-hashable | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest-hashable.svg)](https://hackage.haskell.org/package/genvalidity-sydtest-hashable) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest-hashable/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest-hashable) |
| genvalidity-sydtest-persistent | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest-persistent.svg)](https://hackage.haskell.org/package/genvalidity-sydtest-persistent) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest-persistent/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest-persistent) |
| genvalidity-sydtest-optics | [![Hackage](https://img.shields.io/hackage/v/genvalidity-sydtest-optics.svg)](https://hackage.haskell.org/package/genvalidity-sydtest-optics) | [![Stackage](https://www.stackage.org/package/genvalidity-sydtest-optics/badge/lts)](https://www.stackage.org/package/genvalidity-sydtest-optics) |


## Why?

> to make writing correct software cheaper.
Expand Down Expand Up @@ -108,7 +61,7 @@ ordSpec @Int
+++ OK, passed 100 tests.
```

### Free generators
### Free generators and shrinking

``` haskell
data MyType = MyType
Expand All @@ -117,35 +70,16 @@ data MyType = MyType
} deriving (Show, Eq, Generic)

instance Validity MyType -- Implementation is derived via Generic
instance GenUnchecked MyType -- Implementation is derived via Generic
instance GenValid MyType -- Default implementation via GenUnchecked and Validity
```

``` haskell
genValid :: Gen MyType -- Free access to a generator
instance GenValid MyType -- Default implementation via Generic
```

### Free shrinking

``` haskell
shrinkValid :: MyType -> [MyType] -- Free access to a _valid_ shrinking function
genValid :: Gen MyType -- Free generator
shrinkValid :: MyType -> [MyType] -- Free _valid_ shrinking function
```

## Further Documentation

- [Usage example](docs/USAGE_EXAMPLE.md)
- [Fully worked example](docs/FULLY_WORKED_EXAMPLE.md)
- [High-level package overview](docs/PACKAGE_OVERVIEW.md)


## Cachix cache

There is a [cachix](https://cachix.org) cache for this project.

To use it, use `cachix use validity` or add the appropriate details to your nixos configuration.

## Sponsor this project

Validity is free and open-source software.
Building it takes time, energy and money.
Please consider supporting the project at https://cs-syd.eu/support .
3 changes: 0 additions & 3 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ let
pkgs = import ./nix/pkgs.nix { inherit sources; };

versions = {
"lts-13_19" = "82d2c663b4dffbd635ed694bcc301284987b8097";
"lts-14_23" = "a87b506140a7267477103759c3f8da5b2e8d994e";
"lts-15_03" = "beeb24f1e939be7d85fdd64e31f13b8fe8238150";
"lts-16_11" = "89db531aea80df58584c9a9e3504ffd9617e6b48";
};

Expand Down
81 changes: 0 additions & 81 deletions docs/BYTESTRING.md

This file was deleted.

Loading

0 comments on commit 7d959b5

Please sign in to comment.