Copyright | (c) 2015-2017 Rudy Matela |
---|---|
License | 3-Clause BSD (see the file LICENSE) |
Maintainer | Rudy Matela <rudy@matela.com.br> |
Safe Haskell | None |
Language | Haskell2010 |
This module is part of LeanCheck, a simple enumerative property-based testing library.
Types to aid in property-based testing.
- newtype Int1 = Int1 {}
- newtype Int2 = Int2 {}
- newtype Int3 = Int3 {}
- newtype Int4 = Int4 {}
- newtype Word1 = Word1 {}
- newtype Word2 = Word2 {}
- newtype Word3 = Word3 {}
- newtype Word4 = Word4 {}
- newtype Nat = Nat {}
- newtype Nat1 = Nat1 {}
- newtype Nat2 = Nat2 {}
- newtype Nat3 = Nat3 {}
- newtype Nat4 = Nat4 {}
- newtype Nat5 = Nat5 {}
- newtype Nat6 = Nat6 {}
- newtype Nat7 = Nat7 {}
- type UInt1 = Word1
- type UInt2 = Word2
- type UInt3 = Word3
- type UInt4 = Word4
- newtype X a = X {
- unX :: a
- newtype NoDup a = NoDup [a]
- newtype Bag a = Bag [a]
- newtype Set a = Set [a]
Integer types
Small-width integer types to aid in property-based testing. Sometimes it is useful to limit the possibilities of enumerated values when testing polymorphic functions, these types allow that.
The signed integer types IntN
are of limited bit width N
bounded by -2^(N-1)
to 2^(N-1)-1
.
The unsigned integer types WordN
are of limited bit width N
bounded by 0
to 2^N-1
.
Operations are closed and modulo 2^N
. e.g.:
maxBound + 1 = minBound read "2" = -2 :: Int2 abs minBound = minBound negate n = 2^N - n :: WordN
Single-bit signed integers: -1, 0
Two-bit signed integers: -2, -1, 0, 1
Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3
Four-bit signed integers: -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7
Single-bit unsigned integer: 0, 1
Two-bit unsigned integers: 0, 1, 2, 3
Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7
Four-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Natural numbers modulo 1: 0
Natural numbers modulo 2: 0, 1
Natural numbers modulo 3: 0, 1, 2
Natural numbers modulo 4: 0, 1, 2, 3
Natural numbers modulo 5: 0, 1, 2, 3, 4
Natural numbers modulo 6: 0, 1, 2, 3, 4, 5
Natural numbers modulo 7: 0, 1, 2, 3, 4, 5, 6
Aliases to word types (deprecated)
Extreme Integers
List-wrapper types
NoDup [a] |
Bag [a] |