functor-combinators 0.3.5.0 → 0.3.5.1
raw patch · 7 files changed
+70/−6 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Natural.IsoF: coercedF :: (forall x. Coercible (f x) (g x), forall x. Coercible (g x) (f x)) => f <~> g
+ Control.Natural.IsoF: coercedF :: forall f g. (forall x. Coercible (f x) (g x), forall x. Coercible (g x) (f x)) => f <~> g
Files
- CHANGELOG.md +3/−0
- functor-combinators.cabal +2/−2
- src/Control/Natural/IsoF.hs +1/−1
- src/Data/HBifunctor/Associative.hs +1/−1
- src/Data/HBifunctor/Tensor.hs +18/−2
- src/Data/HFunctor/Chain/Internal.hs +16/−0
- src/Data/HFunctor/Route.hs +29/−0
CHANGELOG.md view
@@ -13,6 +13,9 @@ renamed to *Data.Functor.Invariant.DivAp* and *Data.Functor.Invariant.DecAlt*. +* **v0.3.5.1**: Fixed infinite recursion bug for Tensor instances of+ invariant `Day`/`Night`.+ Version 0.3.4.0 ---------------
functor-combinators.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 29ea615f649da19336efe3cd784f64de049f92e459aea6f853605f1e4a82af91+-- hash: 5ffab6787a63b6742f7dc3dc9eb04a4f68a6ae789f96828dbc2a2f1919fe3855 name: functor-combinators-version: 0.3.5.0+version: 0.3.5.1 synopsis: Tools for functor combinator-based program design description: Tools for working with /functor combinators/: types that take functors (or other indexed types) and returns a new functor that "enhances" or "mixes"
src/Control/Natural/IsoF.hs view
@@ -74,7 +74,7 @@ -- | An isomorphism between two functors that are coercible/have the same -- internal representation. Useful for newtype wrappers.-coercedF :: (forall x. Coercible (f x) (g x), forall x. Coercible (g x) (f x)) => f <~> g+coercedF :: forall f g. (forall x. Coercible (f x) (g x), forall x. Coercible (g x) (f x)) => f <~> g coercedF = isoF coerce coerce -- | Use a '<~>' by retrieving the "forward" function:
src/Data/HBifunctor/Associative.hs view
@@ -534,7 +534,7 @@ appendNEINight_ :: IN.Night (Chain1 IN.Night f) (Chain1 IN.Night f) ~> Chain1 IN.Night f appendNEINight_ (IN.Night xs ys f g h) = case xs of- Done1 x -> More1 (IN.Night x ys f g h)+ Done1 x -> More1 (IN.Night x ys f g h) More1 (IN.Night z zs j k l) -> More1 $ IN.Night z (appendNEINight_ (IN.Night zs ys id Left Right)) (B.assoc . first j . f)
src/Data/HBifunctor/Tensor.hs view
@@ -78,6 +78,7 @@ import Control.Monad.Trans.Compose import Control.Natural import Control.Natural.IsoF+import Data.Bifunctor import Data.Coerce import Data.Data import Data.Function@@ -108,6 +109,7 @@ import Data.List.NonEmpty (NonEmpty(..)) import Data.Void import GHC.Generics+import qualified Data.Bifunctor.Assoc as B import qualified Data.Functor.Contravariant.Coyoneda as CCY import qualified Data.Functor.Contravariant.Day as CD import qualified Data.Functor.Contravariant.Night as N@@ -468,7 +470,14 @@ elim1 = ID.elim2 elim2 = ID.elim1 - appendLB = coerce appendChain+ appendLB (ID.Day (DivAp xs) (DivAp ys) f g) = DivAp $ case xs of+ Done (Identity x) -> invmap (f x) (snd . g) ys+ More (ID.Day z zs h j) -> More $ ID.Day+ z+ (unDivAp $ appendLB (ID.Day (DivAp zs) (DivAp ys) (,) id))+ (\q (r, s) -> f (h q r) s)+ (B.assoc . first j . g)+ splitNE = coerce splitChain1 splittingLB = coercedF . splittingChain . coercedF @@ -496,7 +505,14 @@ elim1 = IN.elim2 elim2 = IN.elim1 - appendLB = coerce appendChain+ appendLB (IN.Night (DecAlt xs) (DecAlt ys) f g h) = DecAlt $ case xs of+ Done r -> invmap h (either (absurd . refute r) id . f) ys+ More (IN.Night z zs j k l) -> More $ IN.Night+ z+ (unDecAlt $ appendLB (IN.Night (DecAlt zs) (DecAlt ys) id Left Right))+ (B.assoc . first j . f)+ (g . k)+ (either (g . l) h) splitNE = coerce splitChain1 splittingLB = coercedF . splittingChain . coercedF
src/Data/HFunctor/Chain/Internal.hs view
@@ -372,6 +372,10 @@ -- You can also extract the 'Ap1' part out using 'divApAp1', and extract the -- 'Div1' part out using 'divApDiv1'. --+-- Note that this type's utility is similar to that of @'PreT' 'Ap1'@,+-- except @'PreT' 'Ap1'@ lets you use 'Apply' typeclass methods to assemble+-- it.+-- -- @since 0.3.5.0 newtype DivAp1 f a = DivAp1_ { unDivAp1 :: Chain1 ID.Day f a } deriving (Invariant, HFunctor, Inject)@@ -407,6 +411,10 @@ -- You can also extract the 'Ap' part out using 'divApAp', and extract the -- 'Div' part out using 'divApDiv'. --+-- Note that this type's utility is similar to that of @'PreT' 'Ap'@,+-- except @'PreT' 'Ap'@ lets you use 'Applicative' typeclass methods to+-- assemble it.+-- -- @since 0.3.5.0 newtype DivAp f a = DivAp { unDivAp :: Chain ID.Day Identity f a } deriving (Invariant, HFunctor)@@ -444,6 +452,10 @@ -- You can also extract the 'NonEmptyF' part out using 'decAltNonEmptyF', and -- extract the 'Dec1' part out using 'decAltDec1'. --+-- Note that this type's utility is similar to that of @'PostT' 'Dec1'@,+-- except @'PostT' 'Dec1'@ lets you use 'Decide' typeclass methods to+-- assemble it.+-- -- @since 0.3.5.0 newtype DecAlt1 f a = DecAlt1_ { unDecAlt1 :: Chain1 IN.Night f a } deriving (Invariant, HFunctor, Inject)@@ -479,6 +491,10 @@ -- -- You can also extract the 'ListF' part out using 'decAltListF', and -- extract the 'Dec' part out using 'decAltDec'.+--+-- Note that this type's utility is similar to that of @'PostT' 'Dec'@,+-- except @'PostT' 'Dec'@ lets you use 'Conclude' typeclass methods to+-- assemble it. -- -- @since 0.3.5.0 newtype DecAlt f a = DecAlt { unDecAlt :: Chain IN.Night IN.Not f a }
src/Data/HFunctor/Route.hs view
@@ -150,6 +150,24 @@ -- however, you can also interpret into covariant contexts with -- 'preDivisibleT', 'preDiviseT', and 'preContravariantT'. --+-- A useful way to use this type is to use normal methods of the underlying+-- @t@ to assemble a final @t@, then using the 'PreT' constructor to wrap+-- it all up.+--+-- @+-- data MyType = MyType+-- { mtInt :: Int+-- , mtBool :: Bool+-- , mtString :: String+-- }+--+-- myThing :: PreT Ap MyFunctor MyType+-- myThing = PreT $ MyType+-- <$> injectPre mtInt (mfInt :: MyFunctor Int )+-- <*> injectPre mtBool (mfBool :: MyFunctor Bool )+-- <*> injectPre mtString (mfString :: MyFunctor STring)+-- @+-- -- See 'Pre' for more information. newtype PreT t f a = PreT { unPreT :: t (Pre a f) a } @@ -175,6 +193,17 @@ -- You can run this normally as if it were a @t f a@ by using 'interpret'; -- however, you can also interpret into covariant contexts with -- 'postPlusT', 'postAltT', and 'postFunctorT'.+--+-- A useful way to use this type is to use normal methods of the underlying+-- @t@ to assemble a final @t@, then using the 'PreT' constructor to wrap+-- it all up.+--+-- @+-- myThing :: PostT Dec MyFunctor (Either Int Bool)+-- myThing = PostT $ decided $+-- (injectPost Left (mfInt :: MyFunctor Int ))+-- (injectPost Right (mfBool :: MyFunctor Bool))+-- @ -- -- See 'Post' for more information. newtype PostT t f a = PostT { unPostT :: t (Post a f) a }