The generic-random package

[maintain]

Please see README.md


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0, 0.1.1.0, 0.2.0.0, 0.3.0.0, 0.4.0.0, 0.4.1.0
Dependenciesad, base (>=4.8 && <5), containers, hashable, hmatrix, ieee754, MonadRandom, mtl, QuickCheck, transformers, unordered-containers, vector [details]
LicenseMIT
AuthorLi-yao Xia
Maintainerlysxia@gmail.com
StabilityExperimental
CategoryGenerics, Testing
Home pagehttp://github.com/lysxia/generic-random
Source repositoryhead: git clone https://github.com/githubuser/generic-random
UploadedTue May 17 15:43:26 UTC 2016 by lyxia

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for generic-random-0.1.0.0

Generic random generators

Define sized random generators for almost any type.

    {-# LANGUAGE DeriveDataTypeable #-}
    import Data.Data
    import Test.QuickCheck
    import Data.Random.Generics

    data Term = Lambda Int Term | App Term Term | Var Int
      deriving (Show, Data)

    instance Arbitrary Term where
      arbitrary = sized $ generatorPWith [positiveInts]

    positiveInts :: Alias Gen
    positiveInts =
      alias $ \() -> fmap getPositive arbitrary :: Gen Int

    main = sample (arbitrary :: Gen Term)

References