packages feed

assoc 1 → 1.0.1

raw patch · 4 files changed

+67/−22 lines, 4 filesdep +taggeddep ~basedep ~bifunctorsPVP ok

version bump matches the API change (PVP)

Dependencies added: tagged

Dependency ranges changed: base, bifunctors

API changes (from Hackage documentation)

+ Data.Bifunctor.Assoc: instance Data.Bifunctor.Assoc.Assoc Data.Functor.Const.Const
+ Data.Bifunctor.Assoc: instance Data.Bifunctor.Assoc.Assoc Data.Tagged.Tagged

Files

+ CHANGELOG.md view
@@ -0,0 +1,3 @@+## 1.0.1++- Add `Assoc Const` and `Tagged` instances
assoc.cabal view
@@ -1,10 +1,10 @@-cabal-version: 1.12-name:          assoc-version:       1-license:       BSD3-license-file:  LICENSE-synopsis:      swap and assoc: Symmetric and Semigroupy Bifunctors-category:      Data+cabal-version:      1.12+name:               assoc+version:            1.0.1+license:            BSD3+license-file:       LICENSE+synopsis:           swap and assoc: Symmetric and Semigroupy Bifunctors+category:           Data description:   Provides generalisations of   @swap :: (a,b) -> (b,a)@ and@@ -12,11 +12,23 @@   to   @Bifunctor@s supporting similar operations (e.g. @Either@, @These@). -author:        Oleg Grenrus <oleg.grenrus@iki.fi>-maintainer:    Oleg Grenrus <oleg.grenrus@iki.fi>--build-type: Simple-tested-with: ghc ==7.0.4 || ==7.2.2 || ==7.4.2 || ==7.6.3 || ==7.8.4 || ==7.10.3 || == 8.0.2 || == 8.2.2 || ==8.4.4 || ==8.6.3+author:             Oleg Grenrus <oleg.grenrus@iki.fi>+maintainer:         Oleg Grenrus <oleg.grenrus@iki.fi>+build-type:         Simple+extra-source-files: CHANGELOG.md+tested-with:+    GHC ==7.0.4+     || ==7.2.2+     || ==7.4.2+     || ==7.6.3+     || ==7.8.4+     || ==7.10.3+     || ==8.0.2+     || ==8.2.2+     || ==8.4.4+     || ==8.6.5+     || ==8.8.1+  , GHCJS ==8.4  source-repository head   type:     git@@ -26,8 +38,9 @@   default-language: Haskell2010   hs-source-dirs:   src   build-depends:-      base        >=4.3   && <4.13-    , bifunctors  >=5.5.2 && <5.6+      base        >=4.3   && <4.14+    , bifunctors  >=5.5.5 && <5.6+    , tagged      >=0.8.6 && <0.9    exposed-modules:     Data.Bifunctor.Assoc
src/Data/Bifunctor/Assoc.hs view
@@ -2,10 +2,12 @@     Assoc (..),     ) where -import Data.Bifunctor (Bifunctor (..))-import Data.Bifunctor.Flip (Flip (..))-import Data.Bifunctor.Tannen (Tannen (..))+import Control.Applicative    (Const (..))+import Data.Bifunctor         (Bifunctor (..))+import Data.Bifunctor.Flip    (Flip (..)) import Data.Bifunctor.Product (Product (..))+import Data.Bifunctor.Tannen  (Tannen (..))+import Data.Tagged            (Tagged (..))  -- | "Semigroup-y" 'Bifunctor's. --@@ -35,6 +37,14 @@     unassoc (Right (Left b))  = Left (Right b)     unassoc (Right (Right c)) = Right c +instance Assoc Const where+    assoc (Const (Const a)) = Const a+    unassoc (Const a) = Const (Const a)++instance Assoc Tagged where+    assoc (Tagged a) = Tagged (Tagged a)+    unassoc (Tagged (Tagged a)) = Tagged a+ instance Assoc p => Assoc (Flip p) where     assoc   = Flip . first Flip . unassoc . second runFlip . runFlip     unassoc = Flip . second Flip . assoc . first runFlip . runFlip@@ -45,6 +55,7 @@ -- -- >>> import Data.Proxy -- >>> import Test.QuickCheck+-- >>> import Test.QuickCheck.Instances -- >>> import Data.Functor.Classes -- -- >>> :{@@ -58,6 +69,12 @@ -- >>> quickCheck $ assocUnassocLaw (Proxy :: Proxy Either) -- +++ OK, passed 100 tests. --+-- >>> quickCheck $ assocUnassocLaw (Proxy :: Proxy Tagged)+-- +++ OK, passed 100 tests.+--+-- >>> quickCheck $ assocUnassocLaw (Proxy :: Proxy Const)+-- +++ OK, passed 100 tests.+-- -- >>> :{ --     let unassocAssocLaw :: (Assoc p, Eq2 p) => Proxy p -> p (p Int Char) Bool -> Bool --         unassocAssocLaw _ x = liftEq2 eq2 (==) (unassoc (assoc x)) x@@ -69,6 +86,12 @@ -- >>> quickCheck $ unassocAssocLaw (Proxy :: Proxy Either) -- +++ OK, passed 100 tests. --+-- >>> quickCheck $ unassocAssocLaw (Proxy :: Proxy Tagged)+-- +++ OK, passed 100 tests.+--+-- >>> quickCheck $ unassocAssocLaw (Proxy :: Proxy Const)+-- +++ OK, passed 100 tests.+-- -- >>> :{ --     let bimapLaw :: (Assoc p, Eq2 p) => Proxy p --                  -> Fun Int Char -> Fun Char Bool -> Fun Bool Int@@ -83,4 +106,10 @@ -- +++ OK, passed 100 tests. -- -- >>> quickCheck $ bimapLaw (Proxy :: Proxy Either)+-- +++ OK, passed 100 tests.+--+-- >>> quickCheck $ bimapLaw (Proxy :: Proxy Tagged)+-- +++ OK, passed 100 tests.+--+-- >>> quickCheck $ bimapLaw (Proxy :: Proxy Const) -- +++ OK, passed 100 tests.
src/Data/Bifunctor/Swap.hs view
@@ -3,12 +3,12 @@     Swap (..),     ) where -import Data.Bifunctor (Bifunctor (..))-import Data.Bifunctor.Flip (Flip (..))+import Data.Bifunctor         (Bifunctor (..))+import Data.Bifunctor.Biff    (Biff (..))+import Data.Bifunctor.Flip    (Flip (..)) import Data.Bifunctor.Product (Product (..))-import Data.Bifunctor.Sum (Sum (..))-import Data.Bifunctor.Tannen (Tannen (..))-import Data.Bifunctor.Biff (Biff (..))+import Data.Bifunctor.Sum     (Sum (..))+import Data.Bifunctor.Tannen  (Tannen (..))  import qualified Data.Tuple