FComp-1.0: Compose music

Safe HaskellNone

HarmTrace.Models.Generator

Synopsis

Documentation

class Generate a whereSource

Methods

gen' :: FrequencyTable -> Int -> Int -> Maybe (Gen a)Source

Instances

Generate U 
GenerateG a => Generate (Var a) 
GenerateG a => Generate (Rec a) 
(Generate a, ConNames a, Generate b, ConNames b) => Generate (:+: a b) 
(Generate a, Generate b) => Generate (:*: a b) 
Generate (CEq k k1 c p q a) 
Generate a => Generate (CEq k k1 c p p a) 

genGdefault :: (Representable a, Generate (Rep a)) => FrequencyTable -> Int -> Maybe (Gen a)Source

Generic arbitrary function, sized and with custom constructor frequencies. This function does not require any particular nesting order of the sums of the generic representation.

arbitrary :: (Representable a, Generate (Rep a)) => Gen aSource

Generic arbitrary function with default sizes and constructor frequencies.

data Gen a

type FrequencyTable = [(String, Int)]Source

A frequency table detailing how often certain constructors should be picked. The String corresponds to the constructor name.

frequency :: [(Int, Gen a)] -> Gen a

Chooses one of the given generators, with a weighted random distribution. The input list must be non-empty.