modelling-tasks-0.0.0.1
Safe HaskellSafe-Inferred
LanguageHaskell2010

Modelling.Auxiliary.Common

Synopsis

Documentation

data Object Source #

Constructors

Object 

Fields

Instances

Instances details
Show Object Source # 
Instance details

Defined in Modelling.Auxiliary.Common

Eq Object Source # 
Instance details

Defined in Modelling.Auxiliary.Common

Methods

(==) :: Object -> Object -> Bool #

(/=) :: Object -> Object -> Bool #

Ord Object Source # 
Instance details

Defined in Modelling.Auxiliary.Common

class Randomise a where Source #

The class of types that allow some form of randomisation.

Minimal complete definition

randomise

Methods

randomise :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => a -> RandT g m a Source #

Shuffles every component without affecting basic overall properties

isRandomisable :: a -> Maybe String Source #

Checks the randomisability of the given value * returns Nothing, if it is randomisable * returns Just the explanation why not, otherwise

Instances

Instances details
Randomise MatchCdOdInstance Source # 
Instance details

Defined in Modelling.CdOd.MatchCdOd

Methods

randomise :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => MatchCdOdInstance -> RandT g m MatchCdOdInstance Source #

isRandomisable :: MatchCdOdInstance -> Maybe String Source #

Randomise NameCdErrorInstance Source # 
Instance details

Defined in Modelling.CdOd.NameCdError

Randomise RepairCdInstance Source # 
Instance details

Defined in Modelling.CdOd.RepairCd

Methods

randomise :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => RepairCdInstance -> RandT g m RepairCdInstance Source #

isRandomisable :: RepairCdInstance -> Maybe String Source #

Randomise SelectValidCdInstance Source # 
Instance details

Defined in Modelling.CdOd.SelectValidCd

class RandomiseLayout a where Source #

The class of types that allow changing its layout randomly.

Methods

randomiseLayout :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => a -> RandT g m a Source #

Instances

Instances details
RandomiseLayout DifferentNamesInstance Source # 
Instance details

Defined in Modelling.CdOd.DifferentNames

Methods

randomiseLayout :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => DifferentNamesInstance -> RandT g m DifferentNamesInstance Source #

RandomiseLayout MatchCdOdInstance Source # 
Instance details

Defined in Modelling.CdOd.MatchCdOd

Methods

randomiseLayout :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => MatchCdOdInstance -> RandT g m MatchCdOdInstance Source #

RandomiseLayout NameCdErrorInstance Source # 
Instance details

Defined in Modelling.CdOd.NameCdError

Methods

randomiseLayout :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => NameCdErrorInstance -> RandT g m NameCdErrorInstance Source #

RandomiseLayout RepairCdInstance Source # 
Instance details

Defined in Modelling.CdOd.RepairCd

Methods

randomiseLayout :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => RepairCdInstance -> RandT g m RepairCdInstance Source #

RandomiseLayout SelectValidCdInstance Source # 
Instance details

Defined in Modelling.CdOd.SelectValidCd

Methods

randomiseLayout :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => SelectValidCdInstance -> RandT g m SelectValidCdInstance Source #

class RandomiseNames a where Source #

The class of types that allow swapping (some of) its components names randomly.

Minimal complete definition

randomiseNames

Methods

hasRandomisableNames :: a -> Maybe String Source #

Checks the randomisability of names for the given value * returns Nothing, if it is randomisable * returns Just the explanation why not, otherwise

randomiseNames :: forall g (m :: Type -> Type). (RandomGen g, MonadThrow m) => a -> RandT g m a Source #

Shuffles the order of names of an instance, swapping names of components

Instances

Instances details
RandomiseNames DifferentNamesInstance Source # 
Instance details

Defined in Modelling.CdOd.DifferentNames

RandomiseNames MatchCdOdInstance Source # 
Instance details

Defined in Modelling.CdOd.MatchCdOd

RandomiseNames NameCdErrorInstance Source # 
Instance details

Defined in Modelling.CdOd.NameCdError

RandomiseNames RepairCdInstance Source # 
Instance details

Defined in Modelling.CdOd.RepairCd

RandomiseNames SelectValidCdInstance Source # 
Instance details

Defined in Modelling.CdOd.SelectValidCd

findFittingRandomElements Source #

Arguments

:: MonadRandom m 
=> Bool

useDifferentElements flag

-> [a]

available elements

-> [a -> m Bool]

predicates to satisfy

-> m (Maybe [a]) 

Find fitting random elements with sophisticated distribution logic Tries valid divisors in descending order with retry mechanism for each divisor

getFirstInstance :: MonadThrow m => [a] -> m a Source #

lensRulesL :: LensRules Source #

mapIndicesTo :: (Eq a, MonadThrow m) => [a] -> [a] -> m [(Int, Int)] Source #

oneOf :: MonadRandom m => [a] -> m a Source #

parseWith :: MonadThrow m => (Int -> Parser a) -> String -> m a Source #

toMap :: (Ord a, Ord b) => Set (a, b) -> Map a (Set b) Source #

weightedShuffle :: (MonadRandom m, Eq a, Real w) => [(a, w)] -> m [a] Source #

Shuffle a list of elements from type a based on given weights of type w, where higher weight indicates a bigger probability of the element occurring at a lower index of the list. The total weight of all elements must not be zero.