Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Modelling.Auxiliary.Common
Contents
Synopsis
- data ModellingTasksException = NeverHappens
- data Object = Object {}
- class Randomise a where
- randomise :: (MonadRandom m, MonadThrow m) => a -> m a
- isRandomisable :: a -> Maybe String
- class RandomiseLayout a where
- randomiseLayout :: (MonadRandom m, MonadThrow m) => a -> m a
- class RandomiseNames a where
- hasRandomisableNames :: a -> Maybe String
- randomiseNames :: (MonadRandom m, MonadThrow m) => a -> m a
- newtype ShuffleExcept g a = ShuffleExcept {
- unShuffleExcept :: RandT g (Either SomeException) a
- data TaskGenerationException = NoInstanceAvailable
- findFittingRandomElements :: MonadRandom m => Bool -> [a] -> [a -> m Bool] -> m (Maybe [a])
- getFirstInstance :: MonadThrow m => [a] -> m a
- lensRulesL :: LensRules
- lowerFirst :: String -> String
- mapIndicesTo :: (Eq a, MonadThrow m) => [a] -> [a] -> m [(Int, Int)]
- oneOf :: MonadRandom m => [a] -> m a
- parseInt :: Parser Int
- parseWith :: MonadThrow m => (Int -> Parser a) -> String -> m a
- skipSpaces :: Parser ()
- toMap :: (Ord a, Ord b) => Set (a, b) -> Map a (Set b)
- upperFirst :: String -> String
- upperToDash :: String -> String
- weightedShuffle :: (MonadRandom m, Eq a, Real w) => [(a, w)] -> m [a]
Documentation
data ModellingTasksException Source #
Constructors
NeverHappens |
Instances
Exception ModellingTasksException Source # | |
Defined in Modelling.Auxiliary.Common | |
Show ModellingTasksException Source # | |
Defined in Modelling.Auxiliary.Common Methods showsPrec :: Int -> ModellingTasksException -> ShowS # show :: ModellingTasksException -> String # showList :: [ModellingTasksException] -> ShowS # |
class Randomise a where Source #
The class of types that allow some form of randomisation.
Minimal complete definition
Methods
randomise :: (MonadRandom m, MonadThrow m) => a -> 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
Randomise MatchCdOdInstance Source # | |
Defined in Modelling.CdOd.MatchCdOd Methods randomise :: (MonadRandom m, MonadThrow m) => MatchCdOdInstance -> m MatchCdOdInstance Source # isRandomisable :: MatchCdOdInstance -> Maybe String Source # | |
Randomise NameCdErrorInstance Source # | |
Defined in Modelling.CdOd.NameCdError Methods randomise :: (MonadRandom m, MonadThrow m) => NameCdErrorInstance -> m NameCdErrorInstance Source # isRandomisable :: NameCdErrorInstance -> Maybe String Source # | |
Randomise RepairCdInstance Source # | |
Defined in Modelling.CdOd.RepairCd Methods randomise :: (MonadRandom m, MonadThrow m) => RepairCdInstance -> m RepairCdInstance Source # | |
Randomise SelectValidCdInstance Source # | |
Defined in Modelling.CdOd.SelectValidCd Methods randomise :: (MonadRandom m, MonadThrow m) => SelectValidCdInstance -> m SelectValidCdInstance Source # isRandomisable :: SelectValidCdInstance -> Maybe String Source # |
class RandomiseLayout a where Source #
The class of types that allow changing its layout randomly.
Methods
randomiseLayout :: (MonadRandom m, MonadThrow m) => a -> m a Source #
Instances
RandomiseLayout DifferentNamesInstance Source # | |
Defined in Modelling.CdOd.DifferentNames Methods randomiseLayout :: (MonadRandom m, MonadThrow m) => DifferentNamesInstance -> m DifferentNamesInstance Source # | |
RandomiseLayout MatchCdOdInstance Source # | |
Defined in Modelling.CdOd.MatchCdOd Methods randomiseLayout :: (MonadRandom m, MonadThrow m) => MatchCdOdInstance -> m MatchCdOdInstance Source # | |
RandomiseLayout NameCdErrorInstance Source # | |
Defined in Modelling.CdOd.NameCdError Methods randomiseLayout :: (MonadRandom m, MonadThrow m) => NameCdErrorInstance -> m NameCdErrorInstance Source # | |
RandomiseLayout RepairCdInstance Source # | |
Defined in Modelling.CdOd.RepairCd Methods randomiseLayout :: (MonadRandom m, MonadThrow m) => RepairCdInstance -> m RepairCdInstance Source # | |
RandomiseLayout SelectValidCdInstance Source # | |
Defined in Modelling.CdOd.SelectValidCd Methods randomiseLayout :: (MonadRandom m, MonadThrow m) => SelectValidCdInstance -> m SelectValidCdInstance Source # |
class RandomiseNames a where Source #
The class of types that allow swapping (some of) its components names randomly.
Minimal complete definition
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 :: (MonadRandom m, MonadThrow m) => a -> m a Source #
Shuffles the order of names of an instance, swapping names of components
Instances
newtype ShuffleExcept g a Source #
Constructors
ShuffleExcept | |
Fields
|
Instances
data TaskGenerationException Source #
Constructors
NoInstanceAvailable |
Instances
Exception TaskGenerationException Source # | |
Defined in Modelling.Auxiliary.Common | |
Show TaskGenerationException Source # | |
Defined in Modelling.Auxiliary.Common Methods showsPrec :: Int -> TaskGenerationException -> ShowS # show :: TaskGenerationException -> String # showList :: [TaskGenerationException] -> ShowS # |
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 #
lowerFirst :: String -> String Source #
mapIndicesTo :: (Eq a, MonadThrow m) => [a] -> [a] -> m [(Int, Int)] Source #
skipSpaces :: Parser () Source #
upperFirst :: String -> String Source #
upperToDash :: String -> String 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.
Orphan instances
MonadThrow m => MonadThrow (RandT g m) Source # | |