action-permutations 0.0.0.0 → 0.0.0.1
raw patch · 2 files changed
+16/−17 lines, 2 filesdep −special-functorsdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: special-functors
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
Control/Applicative/Permutation.hs view
@@ -134,7 +134,7 @@ -- * @'runPerms' ('pure' x) = 'pure' x@ -- -- * @'runPerms' (f '<$>' p) = f '<$>' 'runPerms' p@-runPerms :: Alternative p => Perms p a -> p a +runPerms :: Alternative p => Perms p a -> p a runPerms = foldChoice pars where pars (Branch t p) = flip ($) <$> p <*> runPerms t -- NOT: pars (Branch t p) = runPerms t <*> p@@ -146,15 +146,17 @@ -- -- * @'runPermsSep' sep (f '<$>' 'atom' a '<*>' 'atom' b) = (f '<$>' a '<*' sep '<*>' b) '<|>' ('flip' f '<$>' b '<*' sep '<*>' a)@ ----- It is particularly useful in constructing permutation persers, where+-- It is particularly useful in constructing permutation parsers, where -- @sep@ might be a parser for a comma or other separator.-runPermsSep :: Alternative p => p b -> Perms p a -> p a -runPermsSep sep = foldChoice pars- where pars (Branch t p) = flip ($) <$> p <*> runPermsPref sep t+runPermsSep :: Alternative p => p b -> Perms p a -> p a+runPermsSep sep = foldChoice (runBranchSep sep) -runPermsPref :: Alternative p => p b -> Perms p a -> p a -runPermsPref sep = foldChoice pars- where pars (Branch t p) = flip ($) <$ sep <*> p <*> runPermsPref sep t+runPermsPref :: Alternative p => p b -> Perms p a -> p a+runPermsPref sep (Choice d bs) =+ (sep *> foldr ((<|>) . runBranchSep sep) empty bs) <|> maybe empty pure d++runBranchSep :: Alternative p => p b -> Branch p a -> p a+runBranchSep sep (Branch t p) = flip ($) <$> p <*> runPermsPref sep t foldChoice :: Alternative p => (Branch p a -> p a) -> Perms p a -> p a foldChoice f (Choice d bs) = foldr ((<|>) . f) (maybe empty pure d) bs
action-permutations.cabal view
@@ -1,5 +1,5 @@ name: action-permutations-version: 0.0.0.0+version: 0.0.0.1 license: BSD3 license-file: LICENSE author: Ross Paterson <ross@soi.city.ac.uk>@@ -14,16 +14,13 @@ permutations of elements. This version has a slightly different interface from the paper. build-type: Simple-cabal-version: >= 1.2+cabal-version: >= 1.6 -flag ApplicativeInBase- description: Choose the newer base package, including Applicative and other- Functor classes.+source-repository head+ type: darcs+ location: http://code.haskell.org/~ross/action-permutations library- if flag(ApplicativeInBase)- build-depends: base >= 2- else- build-depends: base >= 1.0 && < 2, special-functors >=1.0 && <1.1+ build-depends: base >= 2 && < 5 exposed-modules: Control.Applicative.Permutation extensions: ExistentialQuantification