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.
This module exports a Listable
instance for function enumeration
via lists of pairs.
This module considers functions as a finite list of exceptional input-output cases to a default value (list of pairs of arguments and results).
- functionPairs :: [[a]] -> [[b]] -> [[[(a, b)]]]
- associations :: [a] -> [[b]] -> [[[(a, b)]]]
- pairsToFunction :: Eq a => [(a, b)] -> a -> b
- defaultFunPairsToFunction :: Eq a => (a -> b) -> [(a, b)] -> a -> b
Documentation
functionPairs :: [[a]] -> [[b]] -> [[[(a, b)]]] Source #
Given tiers of input values and tiers of output values, return tiers with all possible lists of input-output pairs. Those represent functional relations.
associations :: [a] -> [[b]] -> [[[(a, b)]]] Source #
Given a list of domain values, and tiers of codomain values, return tiers of lists of ordered pairs of domain and codomain values.
Technically: tiers of left-total functional relations.
pairsToFunction :: Eq a => [(a, b)] -> a -> b Source #
Returns a partial function given by a list of input-output pairs.
NOTE: This function *will* return undefined values for unbound inputs.
defaultFunPairsToFunction :: Eq a => (a -> b) -> [(a, b)] -> a -> b Source #