Îõ³h$GÐB‰­      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬(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 >ÀÁÂÉÎ×)~S MonadRandomÉA proxy that carries information about the type of generator to use with RandT monad and its ± instance.U 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.V 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.W MonadRandomÇConstruct a random monad computation from a function. (The inverse of X.)X MonadRandomÂUnwrap a random monad computation as a function. (The inverse of W.)Y MonadRandomûEvaluate a random computation with the given initial generator and return the final value, discarding the final generator. Y m s = fst (X m s)Z MonadRandomûEvaluate a random computation with the given initial generator and return the final generator, discarding the final value. Z m s = snd (X m s)[ MonadRandomÙMap both the return value and final generator of a computation using the given function. X ([ f m) = f . X m\ MonadRandom\ f m executes action m% on a generator modified by applying f. \ f m = ´ 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)a MonadRandomÙMap both the return value and final generator of a computation using the given function. ^ (a f m) = f . ^ mb MonadRandomb f m executes action m% on a generator modified by applying f. b f m = ´ f >> mc MonadRandomUniform lifting of a callCCê operation to the new monad. This version rolls back to the original state on entering the continuation.d 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).e MonadRandomLift a catchE operation to the new monad.f MonadRandomLift a listen operation to the new monad.g MonadRandomLift a pass operation to the new monad.h MonadRandom%Evaluate a random computation in the µÖ monad, splitting the global standard generator to get a new one for the computation.i MonadRandom6Evaluate a random computation that is embedded in the µ× monad, splitting the global standard generator to get a new one for the computation.j MonadRandomA U" 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})k MonadRandomSame as j', but discards the resulting generator./withRandGen_ (mkStdGen 2021) uniformM :: IO Int6070831465987696718u MonadRandomv MonadRandomW MonadRandompure random transformer MonadRandom(equivalent generator-passing computationX MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom return value and final generatorY MonadRandom(generator-passing computation to execute MonadRandominitial generator MonadRandom&return value of the random computationZ 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 generatorj MonadRandominitial generator MonadRandom return value and final generatork MonadRandominitial generator MonadRandom return value and final generatorSTUVWXYZ[\]^_`abcdefghijkVWXYZ[\hU]^_`abicdefgSTjk(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 = ´ 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 = ´ 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 generatorST‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—‚ƒ„…†‡ˆ”‰Š‹ŒŽ‘’“•ST–— (c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances)Safe=ÁST‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—(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@Oí¶·¸²³¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ   #" !$%&'()‚ƒ„…†‡ˆ‰Š‹ŒŽ”• (c) Brent Yorgey 2016BSD3 (see LICENSE)byorgey@gmail.com experimentalÒnon-portable (multi-param classes, functional dependencies, undecidable instances)SafeA¹í¶·¸²³¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ   #" !$%&'()UVWXYZ[\]^_`abhi+VWXYZ[\hU]^_`abi   ç   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š_`abcdefghijklmnopqrstu€vwxyz{|}~‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“Ž”•‹–—‹–˜™š›Žœ‹ž‹–Ÿ‹– ‹–¡‹–¢‹–£‹–¤‹¥¦‹¥§‹¨©‹¨ª‹«¬‹«­‹®¯‹®°‹±‹²‹³‹´‹µ‹¶‹·‹¸‹¹‹º‹»‹¼‹½‹¾‹«¿‹ÀÁ‹À‹ÀËÀċů‹ÇÈ‹–É‹–Ê‹–Ë‹–Ì‹–Í‹–΋–Ï‹–Ћ–Ñ‹–Ò‹–ÓÔÕÖÔÕר(MonadRandom-0.5.3-1JmUvdPmauW2LuXhK5Cl9QControl.Monad.Random.LazyControl.Monad.Random.Class!Control.Monad.Trans.Random.StrictControl.Monad.Trans.Random.Lazy System.RandomsplitrandomRrandomrandomRsrandomsControl.Monad.Trans.RandomControl.Monad.RandomControl.Monad.Random.Strict#random-1.2.0-7h4RyWOayRNDypmvRo2ybfrandomIO randomRIO getStdRandom newStdGen getStdGen setStdGen genByteStringRandomSystem.Random.InternalmkStdGengenRangegenShortByteString genWord64R genWord32R genWord64 genWord32 genWord16genWord8next RandomGenStdGenUniform UniformRangeMonadInterleave interleave MonadSplitgetSplit MonadRandom getRandomR getRandom getRandomRs getRandomsweighted weightedMayfromList fromListMayuniform uniformMay$fMonadRandomWriterT$fMonadRandomWriterT0$fMonadRandomStateT$fMonadRandomStateT0$fMonadRandomReaderT$fMonadRandomRWST$fMonadRandomRWST0$fMonadRandomMaybeT$fMonadRandomListT$fMonadRandomIdentityT$fMonadRandomExceptT$fMonadRandomErrorT$fMonadRandomContT$fMonadRandomIO$fMonadSplitgWriterT$fMonadSplitgWriterT0$fMonadSplitgStateT$fMonadSplitgStateT0$fMonadSplitgReaderT$fMonadSplitgRWST$fMonadSplitgRWST0$fMonadSplitgMaybeT$fMonadSplitgListT$fMonadSplitgIdentityT$fMonadSplitgExceptT$fMonadSplitgErrorT$fMonadSplitgContT$fMonadSplitStdGenIO$fMonadInterleaveWriterT$fMonadInterleaveWriterT0$fMonadInterleaveStateT$fMonadInterleaveStateT0$fMonadInterleaveReaderT$fMonadInterleaveRWST$fMonadInterleaveRWST0$fMonadInterleaveMaybeT$fMonadInterleaveListT$fMonadInterleaveIdentityT$fMonadInterleaveExceptT$fMonadInterleaveErrorT$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.TypesCharinteger-wired-inGHC.Integer.TypeIntegerInt StatefulGenGHC.Basereturn>>= mtl-2.2.2Control.Monad.State.ClassmodifyIO Control.MonadguardjoinMonad>>Functorfmap<$Control.Monad.FixMonadFixmfixControl.Monad.Fail MonadFailfailData.TraversablemapMsequenceControl.Monad.IO.ClassMonadIOliftIOmfilter<$!>unless replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMforever<=<>=>filterMforM Data.Foldablemsum sequence_forM_mapM_ Data.Functionfix Data.FunctorvoidapliftM5liftM4liftM3liftM2liftMwhen=<< MonadPlusmzeromplustransformers-0.5.6.2Control.Monad.Trans.Class MonadTranslift