packages feed

contravariant-extras 0.3.1 → 0.3.2

raw patch · 2 files changed

+25/−3 lines, 2 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Contravariant.Extras: contramany :: Decidable f => f a -> f [a]

Files

contravariant-extras.cabal view
@@ -1,7 +1,7 @@ name:   contravariant-extras version:-  0.3.1+  0.3.2 category:   Control synopsis:@@ -52,6 +52,5 @@     tuple-th >= 0.2.5 && < 0.3,     template-haskell >= 2.8 && < 3,     contravariant >= 1.3 && < 2,-    base-prelude >= 0.1.19 && < 2,-    base >= 4.6 && < 5+    base-prelude >= 0.1.19 && < 2 
library/Contravariant/Extras.hs view
@@ -3,7 +3,30 @@   -- |   -- A berserk collection of @contrazip@ functions with arities of up to 42.   module Contravariant.Extras.Contrazip,+  contramany, ) where +import BasePrelude import Contravariant.Extras.Contrazip+import Data.Functor.Contravariant.Divisible+++contramany :: Decidable f => f a -> f [a]+contramany f =+  loop+  where+    loop =+      choose chooser cons nil+      where+        chooser =+          \case+            head : tail ->+              Left (head, tail)+            _ ->+              Right ()+        cons =+          divide id f loop+        nil =+          conquer+