| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Falsify.Permutation
Description
Permutations
Intended for qualified import.
import Data.Falsify.Permutation (Permutation) import qualified Data.Falsify.Permutation as Permutation
Synopsis
- data Permutation
- invariant :: Permutation -> Bool
- toSwaps :: Permutation -> [(Word, Word)]
- identity :: Permutation
- fromSwaps :: [(Word, Word)] -> Permutation
- size :: Permutation -> Int
- apply :: Permutation -> [a] -> [a]
Documentation
data Permutation Source #
Permutation is a sequence of swaps
Instances
| Show Permutation Source # | |
Defined in Data.Falsify.Permutation Methods showsPrec :: Int -> Permutation -> ShowS # show :: Permutation -> String # showList :: [Permutation] -> ShowS # | |
invariant :: Permutation -> Bool Source #
Permutation invariant
For every swap (i, j) in the permutation we must have i > j.
Construction
identity :: Permutation Source #
Identity permutation
Properties
size :: Permutation -> Int Source #
Number of swaps
Using permutations
apply :: Permutation -> [a] -> [a] Source #
Apply permutation