uniform-pair 0.1.14 → 0.1.15
raw patch · 2 files changed
+24/−3 lines, 2 filesdep +adjunctionsdep +distributivePVP ok
version bump matches the API change (PVP)
Dependencies added: adjunctions, distributive
API changes (from Hackage documentation)
+ Data.UniformPair: instance Data.Distributive.Distributive Data.UniformPair.Pair
+ Data.UniformPair: instance Data.Functor.Rep.Representable Data.UniformPair.Pair
Files
- src/Data/UniformPair.hs +20/−2
- uniform-pair.cabal +4/−1
src/Data/UniformPair.hs view
@@ -1,6 +1,12 @@-{-# LANGUAGE CPP, DeriveDataTypeable, DeriveFunctor, DeriveFoldable,- DeriveTraversable #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE TypeFamilies #-}+ {-# OPTIONS_GHC -Wall #-}+ #if MIN_VERSION_base(4,9,0) #define LIFTED_FUNCTOR_CLASSES 1 #else@@ -12,6 +18,7 @@ #endif #endif #endif+ ---------------------------------------------------------------------- -- | -- Module : Data.UniformPair@@ -44,6 +51,8 @@ import Data.Functor.Classes (Eq1(..), Ord1(..), Show1(..)) import Control.Applicative (Applicative(..)) -- ,liftA2 import Control.DeepSeq (NFData(..))+import Data.Distributive (Distributive(..))+import Data.Functor.Rep (Representable(..),distributeRep) import qualified Prelude.Extras as PE (Eq1, Ord1, Show1) @@ -119,6 +128,15 @@ -- where -- (c :# _) = f a -- (_ :# d) = f b++instance Distributive Pair where+ distribute = distributeRep++instance Representable Pair where+ type Rep Pair = Bool+ tabulate f = f False :# f True+ index (f :# _) False = f+ index (_ :# t) True = t -- | Update a component, indexing by 'False' for the first element and 'True' for -- the second.
uniform-pair.cabal view
@@ -1,5 +1,5 @@ Name: uniform-pair-Version: 0.1.14+Version: 0.1.15 Cabal-Version: >= 1.6 Synopsis: Uniform pairs with class instances Category: Data@@ -19,6 +19,8 @@ build-type: Simple data-files: changelog tested-with:+ GHC==8.4.3,+ GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4,@@ -35,6 +37,7 @@ hs-Source-Dirs: src Extensions: Build-Depends: base<5, prelude-extras < 0.5, deepseq+ , distributive, adjunctions Exposed-Modules: Data.UniformPair ghc-options: -Wall