bluefin-internal 0.8.0.0 → 0.8.1.0
raw patch · 4 files changed
+36/−6 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Bluefin.Internal: oneWayCoercibleNewtypeHandle :: forall {k} (h1 :: Effects -> k) (h2 :: Effects -> k) (e :: Effects) (es :: Effects). (e :> es, Coercible (h2 e) (h1 e), OneWayCoercible (h1 e) (h1 es), Coercible (h1 es) (h2 es)) => OneWayCoercibleD (h2 e) (h2 es)
+ Bluefin.Internal.OneWayCoercible: trans3D :: forall {k} (t1 :: k) (t2 :: k) (t3 :: k) (t4 :: k). OneWayCoercibleD t1 t2 -> OneWayCoercibleD t2 t3 -> OneWayCoercibleD t3 t4 -> OneWayCoercibleD t1 t4
Files
- CHANGELOG.md +4/−0
- bluefin-internal.cabal +1/−1
- src/Bluefin/Internal.hs +19/−5
- src/Bluefin/Internal/OneWayCoercible.hs +12/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.8.1.0++* Add `trans3D`, `oneWayCoercibleNewtypeHandle`+ # 0.8.0.0 * Restrict `Reader` type tag to `Effects`
bluefin-internal.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-internal-version: 0.8.0.0+version: 0.8.1.0 license: MIT license-file: LICENSE author: Tom Ellis
src/Bluefin/Internal.hs view
@@ -21,6 +21,7 @@ oneWayCoerce, oneWayCoercible, oneWayCoercion,+ trans3D, unsafeCoercionOfOneWayCoercion, unsafeOneWayCoercible, )@@ -48,6 +49,7 @@ import System.IO.Unsafe (unsafePerformIO) import Unsafe.Coerce (unsafeCoerce) import Prelude hiding (drop, head, read, return)+import Data.Coerce (Coercible) -- | Each inhabitant of @Effects@ is a set of effect tags, used for -- effect tracking to ensure that effects don't escape the scope of@@ -282,7 +284,7 @@ unsafeCoerceEff = coerce weakenEff :: t `In` t' -> Eff t r -> Eff t' r-weakenEff _ = unsafeCoerceEff+weakenEff (In# (# #)) = unsafeCoerceEff insertFirst :: Eff b r -> Eff (c1 :& b) r insertFirst = weakenEff (drop (eq ZW))@@ -579,6 +581,20 @@ -- } +oneWayCoercibleNewtypeHandle ::+ forall h1 h2 e es.+ (e :> es) =>+ ( Coercible (h2 e) (h1 e),+ OneWayCoercible (h1 e) (h1 es),+ Coercible (h1 es) (h2 es)+ ) =>+ OneWayCoercibleD (h2 e) (h2 es)+oneWayCoercibleNewtypeHandle =+ trans3D+ (oneWayCoercible @(h2 e) @(h1 e))+ (oneWayCoercibleImpl @(h1 e) @(h1 es))+ (oneWayCoercible @(h1 es) @(h2 es))+ -- | A convenience type whose only purpose is to avoid writing @(# #)@ -- as an argument to functions which are only functions because -- top-level definitions of unlifted kind are forbidden.@@ -1711,8 +1727,7 @@ mapHandleReader = case coerceH of Coercion -> coerce where oneWayCoerceH :: OneWayCoercion (h e) (h es)- oneWayCoerceH = case handleDictOfHandleD (handleImpl @h) of- MkHandleDict -> oneWayCoercion+ oneWayCoerceH = withHandle @h oneWayCoercion coerceH :: Coercion (h e) (h es) coerceH = unsafeCoercionOfOneWayCoercion oneWayCoerceH@@ -1754,8 +1769,7 @@ runHandleReader h k = do runReader (mapHandle h) $ \(st :: Reader (h es) e) -> do let oneWayCoerceH :: OneWayCoercion (h es) (h (e :& es))- oneWayCoerceH = case handleDictOfHandleD (handleImpl @h) of- MkHandleDict -> oneWayCoercion+ oneWayCoerceH = withHandle @h oneWayCoercion let coerceH :: Coercion (h es) (h (e :& es)) coerceH = unsafeCoercionOfOneWayCoercion oneWayCoerceH
src/Bluefin/Internal/OneWayCoercible.hs view
@@ -96,6 +96,18 @@ Coercion -> case unsafeCoercionOfOneWayCoercion c2 of Coercion -> MkOneWayCoercion Coercion +trans3D ::+ forall t1 t2 t3 t4.+ OneWayCoercibleD t1 t2 ->+ OneWayCoercibleD t2 t3 ->+ OneWayCoercibleD t3 t4 ->+ OneWayCoercibleD t1 t4+trans3D+ (MkOneWayCoercibleD t1t2)+ (MkOneWayCoercibleD t2t3)+ (MkOneWayCoercibleD t3t4) =+ MkOneWayCoercibleD ((t1t2 `trans` t2t3) `trans` t3t4)+ class GOneWayCoercible a b instance GOneWayCoercible U1 U1