smash 0.1.2 → 0.1.3
raw patch · 9 files changed
+66/−23 lines, 9 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +5/−1
- smash.cabal +4/−4
- src/Control/Monad/Trans/Can.hs +2/−2
- src/Control/Monad/Trans/Smash.hs +2/−2
- src/Control/Monad/Trans/Wedge.hs +2/−2
- src/Data/Can.hs +17/−3
- src/Data/Smash.hs +15/−3
- src/Data/Smash/Internal.hs +1/−1
- src/Data/Wedge.hs +18/−5
CHANGELOG.md view
@@ -1,4 +1,8 @@-# Revision history for possibly-can+# Revision history for smash++## 0.1.3 -- 2022-04-03++* Update `base` bounds to allow GHC 9.2.x ## 0.1.2
smash.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: smash-version: 0.1.2+version: 0.1.3 synopsis: Combinators for Maybe types description: Smash products are like the 'These' datatype, only with a unit. You can@@ -12,7 +12,7 @@ license-file: LICENSE author: Emily Pillmore maintainer: emilypi@cohomolo.gy-copyright: (c) 2020-2021 Emily Pillmore <emilypi@cohomolo.gy>+copyright: (c) 2020-2022 Emily Pillmore <emilypi@cohomolo.gy> category: Data build-type: Simple extra-source-files:@@ -20,7 +20,7 @@ README.md tested-with:- GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4 || ==9.0.1+ GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.2 source-repository head type: git@@ -37,7 +37,7 @@ other-modules: Data.Smash.Internal build-depends:- base >=4.11 && <4.16+ base >=4.12 && <4.17 , bifunctors ^>=5.5 , binary ^>=0.8 , deepseq ^>=1.4
src/Control/Monad/Trans/Can.hs view
@@ -8,7 +8,7 @@ {-# language Safe #-} -- | -- Module : Control.Monad.Trans.Can--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>@@ -20,7 +20,7 @@ -- module Control.Monad.Trans.Can ( -- * Monad Transformer- CanT(runCanT)+ CanT(..) -- ** Combinators , mapCanT ) where
src/Control/Monad/Trans/Smash.hs view
@@ -8,7 +8,7 @@ {-# language Safe #-} -- | -- Module : Control.Monad.Trans.Smash--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>@@ -20,7 +20,7 @@ -- module Control.Monad.Trans.Smash ( -- * Monad transformer- SmashT(runSmashT)+ SmashT(..) -- ** Combinators , mapSmashT ) where
src/Control/Monad/Trans/Wedge.hs view
@@ -8,7 +8,7 @@ {-# language Safe #-} -- | -- Module : Control.Monad.Trans.Wedge--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>@@ -20,7 +20,7 @@ -- module Control.Monad.Trans.Wedge ( -- * Monad transformer- WedgeT(runWedgeT)+ WedgeT(..) -- ** Combinators , mapWedgeT ) where
src/Data/Can.hs view
@@ -11,7 +11,7 @@ {-# LANGUAGE Safe #-} -- | -- Module : Data.Can--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>@@ -67,6 +67,7 @@ , partitionAll , partitionEithers , mapCans+, eqCan -- * Distributivity , distributeCan , codistributeCan@@ -90,6 +91,7 @@ import Data.Data import qualified Data.Either as E import Data.Functor.Classes+import Data.Functor.Contravariant (Equivalence(..)) import Data.Foldable import Data.Functor.Identity import Data.Hashable@@ -469,8 +471,8 @@ -- their parts. -- partitionCans- :: Foldable t- => Alternative f+ :: Alternative f+ => Foldable t => t (Can a b) -> (f a, f b) partitionCans = foldr go (empty, empty)@@ -490,6 +492,18 @@ -> t a -> (f b, f c) mapCans f = partitionCans . fmap f++-- | Equivalence relation formed by grouping of equal 'Can' constructors.+--+eqCan :: Equivalence (Can a b)+eqCan = Equivalence equivalence+ where+ equivalence :: Can a b -> Can a b -> Bool+ equivalence Non Non = True+ equivalence (One _) (One _) = True+ equivalence (Eno _) (Eno _) = True+ equivalence (Two _ _) (Two _ _) = True+ equivalence _ _ = False -- -------------------------------------------------------------------- -- -- Distributivity
src/Data/Smash.hs view
@@ -10,7 +10,7 @@ {-# LANGUAGE Safe #-} -- | -- Module : Data.Smash--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>@@ -55,6 +55,7 @@ -- * Partitioning , partitionSmashes , mapSmashes+, eqSmash -- * Currying & Uncurrying , smashCurry , smashUncurry@@ -84,6 +85,7 @@ import Data.Can (Can(..), can) import Data.Data import Data.Functor.Classes+import Data.Functor.Contravariant (Equivalence(..)) import Data.Functor.Identity import Data.Hashable import Data.Wedge (Wedge(..))@@ -348,8 +350,8 @@ -- their parts. -- partitionSmashes- :: Foldable t- => Alternative f+ :: Alternative f+ => Foldable t => t (Smash a b) -> (f a, f b) partitionSmashes = foldr go (empty, empty) where@@ -366,6 +368,16 @@ -> t a -> (f b, f c) mapSmashes f = partitionSmashes . fmap f++-- | Equivalence relation formed by grouping of equal 'Smash' constructors.+--+eqSmash :: Equivalence (Smash a b)+eqSmash = Equivalence equivalence+ where+ equivalence :: Smash a b -> Smash a b -> Bool+ equivalence Nada Nada = True+ equivalence (Smash _ _) (Smash _ _) = True+ equivalence _ _ = False -- -------------------------------------------------------------------- -- -- Currying & Uncurrying
src/Data/Smash/Internal.hs view
@@ -1,7 +1,7 @@ {-# language Safe #-} -- | -- Module : Data.Smash.Internal--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>,
src/Data/Wedge.hs view
@@ -10,7 +10,7 @@ {-# LANGUAGE Safe #-} -- | -- Module : Data.Wedge--- Copyright : (c) 2020-2021 Emily Pillmore+-- Copyright : (c) 2020-2022 Emily Pillmore -- License : BSD-3-Clause -- -- Maintainer : Emily Pillmore <emilypi@cohomolo.gy>@@ -57,6 +57,7 @@ -- ** Partitioning , partitionWedges , mapWedges+, eqWedge -- ** Distributivity , distributeWedge , codistributeWedge@@ -78,6 +79,7 @@ import Data.Bitraversable import Data.Data import Data.Functor.Classes+import Data.Functor.Contravariant (Equivalence(..)) import Data.Functor.Identity import Data.Hashable @@ -365,8 +367,8 @@ -- their parts. -- partitionWedges- :: Foldable t- => Alternative f+ :: Alternative f+ => Foldable t => t (Wedge a b) -> (f a, f b) partitionWedges = foldr go (empty, empty) where@@ -385,6 +387,17 @@ -> (f b, f c) mapWedges f = partitionWedges . fmap f +-- | Equivalence relation formed by grouping of equal 'Wedge' constructors.+--+eqWedge :: Equivalence (Wedge a b)+eqWedge = Equivalence equivalence+ where+ equivalence :: Wedge a b -> Wedge a b -> Bool+ equivalence Nowhere Nowhere = True+ equivalence (Here _) (Here _) = True+ equivalence (There _) (There _) = True+ equivalence _ _ = False+ -- -------------------------------------------------------------------- -- -- Associativity @@ -512,7 +525,7 @@ Here a -> pure (Here a) There b -> There <$> f b -instance Semigroup a => Applicative (Wedge a) where+instance Applicative (Wedge a) where pure = There _ <*> Nowhere = Nowhere@@ -521,7 +534,7 @@ There _ <*> Here b = Here b There f <*> There a = There (f a) -instance Semigroup a => Monad (Wedge a) where+instance Monad (Wedge a) where return = pure (>>) = (*>)