bluefin 0.4.3.0 → 0.5.0.0
raw patch · 3 files changed
+31/−8 lines, 3 filesdep ~bluefin-internalPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bluefin-internal
API changes (from Hackage documentation)
+ Bluefin.Prim: runPrim :: forall (es :: Effects) r. (forall (e :: Effects). () => Prim e -> Eff (e :& es) r) -> Eff es r
- Bluefin.Prim: primitive :: forall (e1 :: Effects) (es :: Effects) (e2 :: Effects) a. (e1 :> es, e2 :> es) => Prim e1 -> (State# (PrimStateEff e2) -> (# State# (PrimStateEff e2), a #)) -> Eff es a
+ Bluefin.Prim: primitive :: forall (e1 :: Effects) (es :: Effects) a. e1 :> es => Prim e1 -> (State# (PrimStateEff e1) -> (# State# (PrimStateEff e1), a #)) -> Eff es a
Files
- CHANGELOG.md +4/−0
- bluefin.cabal +2/−2
- src/Bluefin/Prim.hs +25/−6
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.5.0.0++* Fix dodgy `Bluefin.Primitive.primitive` implementation+ # 0.4.3.0 * Add `Bluefin.GadtEffect`
bluefin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-version: 0.4.3.0+version: 0.5.0.0 license: MIT license-file: LICENSE author: Tom Ellis@@ -45,6 +45,6 @@ Bluefin.System.IO, Bluefin.Writer, build-depends:- bluefin-internal >= 0.4.3.0 && < 0.5+ bluefin-internal >= 0.4.3.0 && < 0.6 hs-source-dirs: src default-language: Haskell2010
src/Bluefin/Prim.hs view
@@ -2,7 +2,7 @@ -- -- @ -- -- Define a handle which includes Prim--- data ExAndPrim e = MkExAndPrim (Exception String e) (Prim e)+-- data ExAndPrim e = MkExAndPrim (Exception String e) (P.Prim e) -- -- Give it a Handle instance, as per Bluefin.Compound -- deriving (Handle) via OneWayCoercibleHandle ExAndPrim -- deriving stock (Generic)@@ -11,15 +11,34 @@ -- oneWayCoercibleImpl = gOneWayCoercible -- -- -- Define a monad M containing the Prim handle--- newtype M es a = MkM (DslBuilderEff ExAndPrim es a)+-- newtype M e es a = MkM (ReaderT (ExAndPrim e) (Eff es) a) -- deriving newtype (Functor, Applicative, Monad) --+-- -- Define a way of running M+-- runM ::+-- (e1 :> es, e2 :> es) =>+-- Exception String e1 ->+-- P.Prim e2 ->+-- M es es r ->+-- Eff es r+-- runM ex prim (MkM m) =+-- runReaderT m (MkExAndPrim (mapHandle ex) (mapHandle prim))+-- -- -- Give M a PrimMonad instance--- instance PrimMonad (M es) where--- type PrimState (M es) = PrimStateEff es+-- instance (e :> es) => PrimMonad (M e es) where+-- type PrimState (M e es) = P.PrimStateEff e -- primitive f =--- MkM (dslBuilderEff (\\(MkExAndPrim _ prim) -> P.primitive prim f))+-- MkM (ReaderT (\\(MkExAndPrim _ prim) -> P.'primitive' prim f))+--+-- -- ghci> example+-- -- Right [\"Hello\",\"World\"]+-- example :: Either String [String]+-- example = runPureEff $ try $ \\ex -> P.'runPrim' $ \\prim -> do+-- runM ex prim $ do+-- arr <- A.newArray 2 \"Hello\"+-- A.writeArray arr 1 \"World\"+-- for [0, 1] (A.readArray arr) -- @-module Bluefin.Prim (Prim, PrimStateEff, primitive) where+module Bluefin.Prim (Prim, runPrim, PrimStateEff, primitive) where import Bluefin.Internal.Prim