Îõ³h*G¬B‡©      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨0.6.1(c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.comSafeÂÄÅÆÈ MonadRandom The class , proivides a convenient interface atop a split! operation on a random generator. MonadRandomIf x :: m a0 is a computation in some random monad, then  interleave x+ works by splitting the generator, running xÐ using one half, and using the other half as the final generator state of  interleave x– (replacing whatever the final generator state otherwise would have been). This means that computation needing random values which comes after  interleave x6 does not necessarily depend on the computation of x. For example: µ>>> evalRandIO $ snd <$> ((,) <$> undefined <*> getRandom) *** Exception: Prelude.undefined >>> evalRandIO $ snd <$> ((,) <$> interleave undefined <*> getRandom) 6192322188769041625ºThis can be used, for example, to allow random computations to run in parallel, or to create lazy infinite structures of random values. In the example below, the infinite tree randTreeÐ cannot be evaluated lazily: even though it is cut off at two levels deep by hew 2Å, the random value in the right subtree still depends on generation of all the random values in the (infinite) left subtree, even though they are ultimately unneeded. Inserting a call to  interleave , as in  randTreeI6, solves the problem: the generator splits at each NodeÑ, so random values in the left and right subtrees are generated independently. èdata Tree = Leaf | Node Int Tree Tree deriving Show hew :: Int -> Tree -> Tree hew 0 _ = Leaf hew _ Leaf = Leaf hew n (Node x l r) = Node x (hew (n-1) l) (hew (n-1) r) randTree :: Rand StdGen Tree randTree = Node <$> getRandom <*> randTree <*> randTree randTreeI :: Rand StdGen Tree randTreeI = interleave $ Node <$> getRandom <*> randTreeI <*> randTreeI ý>>> hew 2 <$> evalRandIO randTree Node 2168685089479838995 (Node (-1040559818952481847) Leaf Leaf) (Node ^CInterrupted. >>> hew 2 <$> evalRandIO randTreeI Node 8243316398511136358 (Node 4139784028141790719 Leaf Leaf) (Node 4473998613878251948 Leaf Leaf) MonadRandom The class ã proivides a way to specify a random number generator that can be split into two new generators.ßThis class is not very useful in practice: typically, one cannot actually do anything with a generator. It remains here to avoid breaking existing code unnecessarily. For a more practically useful interface, see .  MonadRandomThe  Ç operation allows one to obtain two distinct random number generators.See  for details.! MonadRandom3With a source of random number supply in hand, the !Í class allows the programmer to extract random values of a variety of types." MonadRandomTakes a range (lo,hi) and a random number generator gæ, and returns a computation that returns a random value uniformly distributed in the closed interval [lo,hi]Ä, together with a new generator. It is unspecified what happens if lo>hiÀ. For continuous types there is no requirement that the values lo and hiØ are ever produced, but they may be, depending on the implementation and the interval.See  for details.# MonadRandom The same as "3, but using a default range determined by the type: For bounded types (instances of © , such as ª+), the range is normally the whole type.ÆFor fractional types, the range is normally the semi-closed interval [0,1).For «*, the range is (arbitrarily) the range of ¬.See   for details.$ MonadRandomPlural variant of "Ô, producing an infinite list of random values instead of returning a new generator.See   for details.% MonadRandomPlural variant of #Ô, producing an infinite list of random values instead of returning a new generator.See   for details.& MonadRandomâSample a random value from a weighted nonempty collection of elements. Crashes with a call to error; if the collection is empty or the total weight is zero.' MonadRandomÉSample a random value from a weighted collection of elements. Returns Nothing; if the collection is empty or the total weight is zero.( MonadRandomñSample a random value from a weighted list. The list must be non-empty and the total weight must be non-zero.) MonadRandom4Sample a random value from a weighted list. Return Nothing< if the list is empty or the total weight is nonpositive.* MonadRandomÀSample a value uniformly from a nonempty collection of elements.+ MonadRandomÃSample a value uniformly from a collection of elements. Return Nothing if the collection is empty.!"#$% ()*+&'!"#$% ()*+&'(c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances) Trustworthy ÂÄÅÆÍÒÛ)~O MonadRandomÉA proxy that carries information about the type of generator to use with RandT monad and its ­ instance.Q MonadRandom,A random transformer monad parameterized by:g - The generator.m - The inner monad.The ®0 function leaves the generator unchanged, while ¯Ü uses the final generator of the first computation as the initial generator of the second.R MonadRandom)A random monad parameterized by the type g of the generator to carry.The ®0 function leaves the generator unchanged, while ¯Ü uses the final generator of the first computation as the initial generator of the second.S MonadRandomÇConstruct a random monad computation from a function. (The inverse of T.)T MonadRandomÂUnwrap a random monad computation as a function. (The inverse of S.)U MonadRandomûEvaluate a random computation with the given initial generator and return the final value, discarding the final generator. U m s = fst (T m s)V MonadRandomûEvaluate a random computation with the given initial generator and return the final generator, discarding the final value. V m s = snd (T m s)W MonadRandomÙMap both the return value and final generator of a computation using the given function. T (W f m) = f . T mX MonadRandomX f m executes action m% on a generator modified by applying f. X f m = modify f >> mY MonadRandomÏConstruct a random monad computation from an impure function. (The inverse of Z.)Z MonadRandomÊUnwrap a random monad computation as an impure function. (The inverse of Y.)[ MonadRandomûEvaluate a random computation with the given initial generator and return the final value, discarding the final generator. [ m g = liftM fst (Z m g)\ MonadRandomûEvaluate a random computation with the given initial generator and return the final generator, discarding the final value. \ m g = liftM snd (Z m g)] MonadRandomÙMap both the return value and final generator of a computation using the given function. Z (] f m) = f . Z m^ MonadRandom^ f m executes action m% on a generator modified by applying f. ^ f m = modify f >> m_ MonadRandomUniform lifting of a callCCê operation to the new monad. This version rolls back to the original state on entering the continuation.` MonadRandomIn-situ lifting of a callCC’ operation to the new monad. This version uses the current state on entering the continuation. It does not satisfy the uniformity property (see Control.Monad.Signatures).a MonadRandomLift a catchE operation to the new monad.b MonadRandomLift a listen operation to the new monad.c MonadRandomLift a pass operation to the new monad.d MonadRandom%Evaluate a random computation in the °Ö monad, splitting the global standard generator to get a new one for the computation.e MonadRandom6Evaluate a random computation that is embedded in the °× monad, splitting the global standard generator to get a new one for the computation.f MonadRandomA Q" runner that allows using it with ­ê restricted actions. Returns the outcome of random computation and the new pseudo-random-number generator8withRandGen (mkStdGen 2021) uniformM :: IO (Int, StdGen)×(6070831465987696718,StdGen {unStdGen = SMGen 4687568268719557181 4805600293067301895})g MonadRandomSame as f', but discards the resulting generator./withRandGen_ (mkStdGen 2021) uniformM :: IO Int6070831465987696718q MonadRandomr MonadRandomS MonadRandompure random transformer MonadRandom(equivalent generator-passing computationT MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom return value and final generatorU MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom&return value of the random computationV MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandomfinal generatorY MonadRandomimpure random transformer MonadRandom(equivalent generator-passing computationZ MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom return value and final generatorf MonadRandominitial generator MonadRandom return value and final generatorg MonadRandominitial generator MonadRandom return value and final generatorRSTUVWXdQYZ[\]^e_`abcOPfgRSTUVWXdQYZ[\]^e_`abcOPfg(c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances) Trustworthy ÂÄÅÆÍÒÛ<®} MonadRandom,A random transformer monad parameterized by:g - The generator.m - The inner monad.The ®0 function leaves the generator unchanged, while ¯Ü uses the final generator of the first computation as the initial generator of the second.~ MonadRandom)A random monad parameterized by the type g of the generator to carry.The ®0 function leaves the generator unchanged, while ¯Ü uses the final generator of the first computation as the initial generator of the second. MonadRandomÇConstruct a random monad computation from a function. (The inverse of €.)€ MonadRandomÂUnwrap a random monad computation as a function. (The inverse of .) MonadRandomûEvaluate a random computation with the given initial generator and return the final value, discarding the final generator.  m s = fst (€ m s)‚ MonadRandomûEvaluate a random computation with the given initial generator and return the final generator, discarding the final value. ‚ m s = snd (€ m s)ƒ MonadRandomÙMap both the return value and final generator of a computation using the given function. € (ƒ f m) = f . € m„ MonadRandom„ f m executes action m% on a generator modified by applying f. „ f m = modify f >> m… MonadRandomÏConstruct a random monad computation from an impure function. (The inverse of †.)† MonadRandomÊUnwrap a random monad computation as an impure function. (The inverse of ….)‡ MonadRandomûEvaluate a random computation with the given initial generator and return the final value, discarding the final generator. ‡ m g = liftM fst († m g)ˆ MonadRandomûEvaluate a random computation with the given initial generator and return the final generator, discarding the final value. ˆ m g = liftM snd († m g)‰ MonadRandomÙMap both the return value and final generator of a computation using the given function. † (‰ f m) = f . † mŠ MonadRandomŠ f m executes action m% on a generator modified by applying f. Š f m = modify f >> m‹ MonadRandomUniform lifting of a callCCê operation to the new monad. This version rolls back to the original state on entering the continuation.Œ MonadRandomIn-situ lifting of a callCC’ operation to the new monad. This version uses the current state on entering the continuation. It does not satisfy the uniformity property (see Control.Monad.Signatures). MonadRandomLift a catchE operation to the new monad.Ž MonadRandomLift a listen operation to the new monad. MonadRandomLift a pass operation to the new monad. MonadRandom%Evaluate a random computation in the °Ö monad, splitting the global standard generator to get a new one for the computation.‘ MonadRandom6Evaluate a random computation that is embedded in the °× monad, splitting the global standard generator to get a new one for the computation.’ MonadRandomA }" runner that allows using it with ­ê restricted actions. Returns the outcome of random computation and the new pseudo-random-number generator8withRandGen (mkStdGen 2021) uniformM :: IO (Int, StdGen)×(6070831465987696718,StdGen {unStdGen = SMGen 4687568268719557181 4805600293067301895})“ MonadRandomSame as ’', but discards the resulting generator./withRandGen_ (mkStdGen 2021) uniformM :: IO Int6070831465987696718” MonadRandom• MonadRandom MonadRandompure random transformer MonadRandom(equivalent generator-passing computation€ MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom return value and final generator MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom&return value of the random computation‚ MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandomfinal generator… MonadRandomimpure random transformer MonadRandom(equivalent generator-passing computation† MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom return value and final generator’ MonadRandominitial generator MonadRandom return value and final generator“ MonadRandominitial generator MonadRandom return value and final generator~€‚ƒ„}…†‡ˆ‰Š‹ŒŽ‘OP’“~€‚ƒ„}…†‡ˆ‰Š‹ŒŽ‘OP’“ (c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances)Safe=Á~}OP‹ŽŒ€‚ƒ„…†‡ˆ‰Š‘’“(c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances)Safe>§ï~€‚ƒ„}…†‡ˆ‰Š‘ !"#$% (*)+&'±²³´¯®µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàá-~€‚ƒ„}…†‡ˆ‰Š‘  (c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances)Safe@Jï±²³Þß´¯®µ¶·¸Ûܹºàá !"#$% ~}»¼½¾¿À(ÁÂÃÄÅÆÇÈÉÝÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚ*)+&'€‚ƒ„…†‡ˆ‰Š‘(c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances)SafeA³ïRSTUVWXdQYZ[\]^e !"#$% (*)+&'±²³´¯®µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàá-RSTUVWXdQYZ[\]^e â !   "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡\]^_`abcdefghijklmnopqr|}stuvwxyz{~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‹Œ‘’ˆ“”ˆ“•‹Œ–ˆ“—ˆ“˜ˆ“™ˆ“šˆ“›ˆ“œˆ“ˆ“žˆŸ ˆŸ¡ˆ¢£ˆ¢¤ˆ¢¥ˆ¦§ˆ“¨ˆ¦©ˆ“ªˆ“«ˆ“¬ˆ“­ˆ“®ˆ“¯ˆ“°ˆ“±ˆ²³ˆ´µˆ´¶ˆ´·ˆ´¸ˆ¦¹ˆ¦ºˆ¦»ˆ¦¼ˆ¦½ˆ¦¾ˆ¦¿ˆ¦Àˆ¦Áˆ¦Âˆ¦Ãˆ¦Äˆ¦ÅˆÆÇˆÆÈˆÉʈË̈ËÍÎÏÐÎÏÑÒ(MonadRandom-0.6.1-EvIBgppPUp0JggTtFbxlVmControl.Monad.Random.LazyControl.Monad.Random.Class!Control.Monad.Trans.Random.StrictControl.Monad.Trans.Random.Lazy MonadRandom System.RandomsplitrandomRrandomrandomRsrandomsControl.Monad.Trans.RandomControl.Monad.RandomControl.Monad.Random.Strict%random-1.2.1.2-BueTXQ4cpBz2A3gkI9h8O2System.Random.GFiniteFiniteSystem.Random.Internal UniformRangeUniformStdGen RandomGennextgenWord8 genWord16 genWord32 genWord64 genWord32R genWord64RgenShortByteStringgenRangemkStdGenRandom genByteString initStdGen setStdGen getStdGen newStdGen getStdRandom randomRIOrandomIOMonadInterleave interleave MonadSplitgetSplit getRandomR getRandom getRandomRs getRandomsweighted weightedMayfromList fromListMayuniform uniformMay$fMonadRandomWriterT$fMonadRandomWriterT0$fMonadRandomStateT$fMonadRandomStateT0$fMonadRandomReaderT$fMonadRandomRWST$fMonadRandomRWST0$fMonadRandomMaybeT$fMonadRandomIdentityT$fMonadRandomExceptT$fMonadRandomContT$fMonadRandomIO$fMonadSplitgWriterT$fMonadSplitgWriterT0$fMonadSplitgStateT$fMonadSplitgStateT0$fMonadSplitgReaderT$fMonadSplitgRWST$fMonadSplitgRWST0$fMonadSplitgMaybeT$fMonadSplitgIdentityT$fMonadSplitgExceptT$fMonadSplitgContT$fMonadSplitStdGenIO$fMonadInterleaveWriterT$fMonadInterleaveWriterT0$fMonadInterleaveStateT$fMonadInterleaveStateT0$fMonadInterleaveReaderT$fMonadInterleaveRWST$fMonadInterleaveRWST0$fMonadInterleaveMaybeT$fMonadInterleaveIdentityT$fMonadInterleaveExceptT$fMonadInterleaveContTRandGenRandTRandliftRandrunRandevalRandexecRandmapRandwithRand liftRandTrunRandT evalRandT execRandTmapRandT withRandT liftCallCC liftCallCC' liftCatch liftListenliftPass evalRandIO evalRandTIO withRandGen withRandGen_$fMonadFailRandT$fPrimMonadRandT$fMonadStatesRandT$fMonadInterleaveRandT$fMonadSplitgRandT$fMonadRandomRandT$fMonadRWSrwsRandT$fMonadErroreRandT$fMonadContRandT$fRandomGenMRandGengRandT$fStatefulGenRandGenRandT$fFunctorRandT$fApplicativeRandT$fAlternativeRandT $fMonadRandT$fMonadPlusRandT$fMonadTransRandT$fMonadIORandT$fMonadFixRandT$fMonadReaderrRandT$fMonadWriterwRandTbaseGHC.EnumBoundedghc-prim GHC.TypesChar ghc-bignumGHC.Num.IntegerIntegerInt StatefulGenGHC.Basereturn>>=IO MonadPlusmzeromplusMonad>>Functorfmap<$Control.Monad.Fail MonadFailfailData.TraversablemapMsequenceforM Control.MonadforeverliftMguardjoin=<<whenliftM2liftM3liftM4liftM5ap Data.Functorvoid Data.FoldablemapM_forM_ sequence_msumfilterM>=><=< mapAndUnzipMzipWithM zipWithM_foldMfoldM_ replicateM replicateM_unless<$!>mfilterControl.Monad.FixMonadFixmfix Data.FunctionfixControl.Monad.IO.ClassMonadIOliftIOtransformers-0.6.1.0Control.Monad.Trans.Class MonadTranslift