packages feed

bluefin-random 0.2.0.0 → 0.2.1.0

raw patch · 3 files changed

+37/−24 lines, 3 filesdep ~bluefinPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: bluefin

API changes (from Hackage documentation)

- Bluefin.Random: instance (e Bluefin.Internal.:> es, System.Random.Internal.RandomGen g) => System.Random.Internal.FrozenGen (Bluefin.Random.RandomPure g e) (Bluefin.Internal.Eff es)
- Bluefin.Random: instance (e Bluefin.Internal.:> es, System.Random.Internal.RandomGen g) => System.Random.Internal.StatefulGen (Bluefin.Random.Random g e) (Bluefin.Internal.Eff es)
+ Bluefin.Random: instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Random.Random g e) (Bluefin.Random.Random g es)
+ Bluefin.Random: instance (e Bluefin.Internal.<: es, System.Random.Internal.RandomGen g) => System.Random.Internal.FrozenGen (Bluefin.Random.RandomPure g e) (Bluefin.Internal.Eff es)
+ Bluefin.Random: instance (e Bluefin.Internal.<: es, System.Random.Internal.RandomGen g) => System.Random.Internal.StatefulGen (Bluefin.Random.Random g e) (Bluefin.Internal.Eff es)
- Bluefin.Random: withInitStdGen :: forall (e1 :: Effects) (es :: Effects) a. e1 :> es => IOE e1 -> (forall (e :: Effects). () => Random StdGen e -> Eff (e :& es) a) -> Eff es a
+ Bluefin.Random: withInitStdGen :: forall (e1 :: Effects) (es :: Effects) a. e1 <: es => IOE e1 -> (forall (e :: Effects). () => Random StdGen e -> Eff (e :& es) a) -> Eff es a

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.2.1.0++* Add `OneWayCoercible` instance for `Random`+ ## 0.2.0.0  * Transitive version bump because of choice of different incoherent
bluefin-random.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               bluefin-random-version:            0.2.0.0+version:            0.2.1.0 license:            MIT license-file:       LICENSE author:             Tom Ellis@@ -75,8 +75,8 @@     default-language: Haskell2010     hs-source-dirs: src     build-depends:-      base >= 4.14 && < 4.22,+      base >= 4.14 && < 4.23,       random >= 1.3 && < 1.4,-      bluefin >= 0.2.0.0 && < 0.3+      bluefin >= 0.7.1.0 && < 0.8     exposed-modules:       Bluefin.Random
src/Bluefin/Random.hs view
@@ -1,7 +1,8 @@+{-# LANGUAGE DerivingVia #-} {-# LANGUAGE TypeFamilies #-}  module Bluefin.Random-  ( -- * Handle+  ( -- * Capability     Random,      -- * Handlers@@ -21,12 +22,17 @@   ) where -import Bluefin.Compound (Handle)-import Bluefin.Eff (Eff, Effects, (:&), (:>))+import Bluefin.Compound+  ( Handle,+    OneWayCoercible (oneWayCoercibleImpl),+    OneWayCoercibleHandle (MkOneWayCoercibleHandle),+    oneWayCoercibleNewtypeHandle,+  )+import Bluefin.Eff (Eff, Effects, (:&), type (<:)) import Bluefin.IO (IOE, effIO) import Bluefin.State (State, get, put, runState)-import qualified System.Random as Rnd-import qualified System.Random.Stateful as Rnd+import System.Random qualified as Rnd+import System.Random.Stateful qualified as Rnd  -- $specialpurposehandlers --@@ -42,14 +48,14 @@ -- -- @ -- 'System.Random.Stateful.uniformM' ::---   (Uniform a, RandomGen g, e1 :> es) =>+--   (Uniform a, RandomGen g, e1 \<: es) => --   Random g e1 -> --   Eff es a -- @ -- -- @ -- 'System.Random.Stateful.uniformRM' ::---   (UniformRange a, RandomGen g, e1 :> es) =>+--   (UniformRange a, RandomGen g, e1 \<: es) => --   (a, a) -> --   Random g e1 -> --   Eff es a@@ -57,7 +63,7 @@ -- -- @ -- 'System.Random.Stateful.uniformListM' ::---   (Uniform a, RandomGen g, e1 :> es) =>+--   (Uniform a, RandomGen g, e1 \<: es) => --   Int -> --   Random g e1 -> --   Eff es [a]@@ -65,7 +71,7 @@ -- -- @ -- 'System.Random.Stateful.uniformListRM' ::---   (UniformRange a, RandomGen g, e1 :> es) =>+--   (UniformRange a, RandomGen g, e1 \<: es) => --   Int -> --   (a, a) -> --   Random g e1 ->@@ -74,7 +80,7 @@ -- -- @ -- 'System.Random.Stateful.uniformShuffleListM' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   [a] -> --   Random g e1 -> --   Eff es [a]@@ -82,7 +88,7 @@ -- -- @ -- 'System.Random.Stateful.uniformByteArrayM' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Bool -> --   Int -> --   Random g e1 ->@@ -91,7 +97,7 @@ -- -- @ -- 'System.Random.Stateful.uniformByteStringM' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Int -> --   Random g e1 -> --   Eff es ByteString@@ -99,7 +105,7 @@ -- -- @ -- 'System.Random.Stateful.uniformShortByteStringM' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Int -> --   Random g e1 -> --   Eff es ShortByteString@@ -107,28 +113,28 @@ -- -- @ -- 'System.Random.Stateful.uniformDouble01M' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Random g e1 -> --   Eff es Double -- @ -- -- @ -- 'System.Random.Stateful.uniformDoublePositive01M' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Random g e1 -> --   Eff es Double -- @ -- -- @ -- 'System.Random.Stateful.uniformFloat01M' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Random g e1 -> --   Eff es Float -- @ -- -- @ -- 'System.Random.Stateful.uniformFloatPositive01M' ::---   (RandomGen g, e1 :> es) =>+--   (RandomGen g, e1 \<: es) => --   Random g e1 -> --   Eff es Float -- @@@ -141,13 +147,16 @@ -- You will most likely never need to use @RandomPure@ directly.  newtype Random g e = Random (State g e)-  deriving newtype (Handle)+  deriving (Handle) via OneWayCoercibleHandle (Random g) +instance (e <: es) => OneWayCoercible (Random g e) (Random g es) where+  oneWayCoercibleImpl = oneWayCoercibleNewtypeHandle @(State g)+ newtype RandomPure g (e :: Effects) = RandomPure g   deriving newtype (Rnd.RandomGen)  instance-  (e :> es, Rnd.RandomGen g) =>+  (e <: es, Rnd.RandomGen g) =>   Rnd.StatefulGen (Random g e) (Eff es)   where   uniformWord64 =@@ -157,7 +166,7 @@     flip Rnd.modifyGen (Rnd.uniformByteArray pinned size)  instance-  (e :> es, Rnd.RandomGen g) =>+  (e <: es, Rnd.RandomGen g) =>   Rnd.FrozenGen (RandomPure g e) (Eff es)   where   type MutableGen (RandomPure g e) (Eff es) = Random g e@@ -186,7 +195,7 @@ -- need to use a 'Rnd.RandomGen' other than 'Rnd.StdGen' or you know -- you need to create a 'Rnd.StdGen' seed in a non-standard way. withInitStdGen ::-  (e1 :> es) =>+  (e1 <: es) =>   IOE e1 ->   (forall e. Random Rnd.StdGen e -> Eff (e :& es) a) ->   -- | ͘