pointed 4.1.1 → 4.2
raw patch · 3 files changed
+16/−3 lines, 3 filesdep +kan-extensions
Dependencies added: kan-extensions
Files
- pointed.cabal +2/−1
- src/Data/Copointed.hs +7/−1
- src/Data/Pointed.hs +7/−1
pointed.cabal view
@@ -1,6 +1,6 @@ name: pointed category: Data-version: 4.1.1+version: 4.2 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -27,6 +27,7 @@ containers >= 0.4 && < 0.6, comonad >= 4 && < 5, data-default-class >= 0.0.1 && < 0.1,+ kan-extensions >= 4.2 && < 5, semigroups >= 0.8.3.1 && < 1, semigroupoids >= 4 && < 5, stm >= 2.1.2.1 && < 2.5,
src/Data/Copointed.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE TypeFamilies #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} #endif module Data.Copointed where @@ -8,6 +9,7 @@ import Data.Functor.Identity import Data.Functor.Compose import Data.Functor.Coproduct+import Data.Functor.Kan.Lift import qualified Data.Functor.Sum as F import Data.Tree import Data.Semigroup as Semigroup@@ -59,6 +61,10 @@ instance (Copointed p, Copointed q) => Copointed (Coproduct p q) where copoint = coproduct copoint copoint++instance (Functor g, g ~ h) => Copointed (Lift g h) where+ copoint x = runIdentity (runLift x (fmap Identity))+ {-# INLINE copoint #-} instance Copointed m => Copointed (IdentityT m) where copoint = copoint . runIdentityT
src/Data/Pointed.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE TypeFamilies #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-} #endif module Data.Pointed where @@ -17,6 +18,7 @@ import Data.Set (Set) import qualified Data.Set as Set import Data.Functor.Constant+import Data.Functor.Kan.Rift import qualified Data.Functor.Product as Functor import Data.Functor.Compose import Data.Functor.Reverse@@ -138,6 +140,10 @@ instance Pointed (Lift f) where point = Pure++instance (Functor g, g ~ h) => Pointed (Rift g h) where+ point a = Rift (fmap ($a))+ {-# INLINE point #-} instance (Pointed p, Pointed q) => Pointed (Functor.Product p q) where point a = Functor.Pair (point a) (point a)