| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bluefin.Random
Synopsis
- data Random g (e :: Effects)
- withInitStdGen :: forall (e1 :: Effects) (es :: Effects) a. e1 :> es => IOE e1 -> (forall (e :: Effects). Random StdGen e -> Eff (e :& es) a) -> Eff es a
- evalRandom :: forall g (es :: Effects) a. g -> (forall (e :: Effects). Random g e -> Eff (e :& es) a) -> Eff es a
- runRandom :: forall g (es :: Effects) a. g -> (forall (e :: Effects). Random g e -> Eff (e :& es) a) -> Eff es (a, g)
- data RandomPure g (e :: Effects)
Handle
data Random g (e :: Effects) Source #
Instances
| Handle (Random g) Source # | |
| (e :> es, RandomGen g) => StatefulGen (Random g e) (Eff es) Source # | |
Defined in Bluefin.Random Methods uniformWord32R :: Word32 -> Random g e -> Eff es Word32 # uniformWord64R :: Word64 -> Random g e -> Eff es Word64 # uniformWord8 :: Random g e -> Eff es Word8 # uniformWord16 :: Random g e -> Eff es Word16 # uniformWord32 :: Random g e -> Eff es Word32 # uniformWord64 :: Random g e -> Eff es Word64 # uniformByteArrayM :: Bool -> Int -> Random g e -> Eff es ByteArray # uniformShortByteString :: Int -> Random g e -> Eff es ShortByteString # | |
Handlers
Special purpose handlers
In the vast majority of cases you should use withInitStdGen and
you won't have any need for these special purpose handlers.
Effectful operations
To run random operations in Bluefin you should use the random
operations in the System.Random.Stateful module from the random
package. Here are their type signatures when restricted to
Bluefin's Random:
uniformM ::
(Uniform a, RandomGen g, e1 :> es) =>
Random g e1 ->
Eff es a
uniformRM ::
(UniformRange a, RandomGen g, e1 :> es) =>
(a, a) ->
Random g e1 ->
Eff es a
uniformListM ::
(Uniform a, RandomGen g, e1 :> es) =>
Int ->
Random g e1 ->
Eff es [a]
uniformListRM ::
(UniformRange a, RandomGen g, e1 :> es) =>
Int ->
(a, a) ->
Random g e1 ->
Eff es [a]
uniformShuffleListM ::
(RandomGen g, e1 :> es) =>
[a] ->
Random g e1 ->
Eff es [a]
uniformByteArrayM ::
(RandomGen g, e1 :> es) =>
Bool ->
Int ->
Random g e1 ->
Eff es ByteArray
uniformByteStringM ::
(RandomGen g, e1 :> es) =>
Int ->
Random g e1 ->
Eff es ByteString
uniformShortByteStringM ::
(RandomGen g, e1 :> es) =>
Int ->
Random g e1 ->
Eff es ShortByteString
uniformDouble01M ::
(RandomGen g, e1 :> es) =>
Random g e1 ->
Eff es Double
uniformDoublePositive01M ::
(RandomGen g, e1 :> es) =>
Random g e1 ->
Eff es Double
uniformFloat01M ::
(RandomGen g, e1 :> es) =>
Random g e1 ->
Eff es Float
uniformFloatPositive01M ::
(RandomGen g, e1 :> es) =>
Random g e1 ->
Eff es Float
Internal details
RandomPure is an internal detail that is used to implement a
FrozenGen instance for Random. You may
see it in error messages, so we include it here from completeness.
You will most likely never need to use RandomPure directly.
data RandomPure g (e :: Effects) Source #