bizzlelude 1.0.3 → 1.0.4
raw patch · 2 files changed
+23/−8 lines, 2 filesdep ~containersdep ~directorydep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers, directory, text
API changes (from Hackage documentation)
+ Bizzlelude: (<&>) :: Functor f => f a -> (a -> b) -> f b
+ Bizzlelude: return' :: (Monad m) => a -> m a
+ Bizzlelude: uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)
+ Bizzlelude: uncurry4 :: (a -> b -> c -> d -> e) -> ((a, b, c, d) -> e)
+ Bizzlelude: uncurry5 :: (a -> b -> c -> d -> e -> f) -> ((a, b, c, d, e) -> f)
Files
- bizzlelude.cabal +4/−4
- src/main/Bizzlelude.hs +19/−4
bizzlelude.cabal view
@@ -1,5 +1,5 @@ Name: bizzlelude-Version: 1.0.3+Version: 1.0.4 Cabal-version: >=1.22.0 License: BSD3 License-File: LICENSE.txt@@ -27,6 +27,6 @@ -funbox-strict-fields Build-depends: base >= 4.8 && < 5,- containers >= 0.5.7 && < 0.5.8,- directory >= 1.3.0 && < 1.3.1,- text >= 1.2.2 && < 1.2.3+ containers >= 0.5.7 && < 0.6.0,+ directory >= 1.3.0 && < 1.4.0,+ text >= 1.2.2 && < 1.3.0
src/main/Bizzlelude.hs view
@@ -1,9 +1,9 @@-module Bizzlelude((|>), asPath, asString, asText, concat, error, groupOn, listDirsRecursively, map, putStrFlush, scalaGroupBy, showText, unsafeRead+module Bizzlelude((|>), (<&>), asPath, asString, asText, concat, error, groupOn, listDirsRecursively, map, putStrFlush, return', scalaGroupBy, showText, uncurry3, uncurry4, uncurry5, unsafeRead , module Control.Arrow, module Control.Applicative, module Control.Monad, module Data.Bifunctor, module Data.Bool, module Data.Char, module Data.Either, module Data.Eq, module Data.Foldable, module Data.Function, module Data.Functor, module Data.Int, module Data.IntSet, module Data.Map, module Data.Maybe, module Data.Monoid, module Data.Set, module Data.Text, module Data.Tuple, module Debug.Trace, module Prelude, module Numeric, module System.IO.Error) where import Control.Arrow((&&&), (***), (>>>)) import Control.Applicative(Alternative((<|>)), Applicative((<*>), (<*), (*>), pure))-import Control.Monad((>=>), filterM, foldM, foldM_, forM, forM_, guard, mapM, mapM_, Monad((>>), (>>=), return), MonadPlus(), sequence, sequence_, unless, when)+import Control.Monad((>=>), filterM, foldM, foldM_, forM, forM_, guard, join, mapM, mapM_, Monad((>>), (>>=), return), MonadPlus(), sequence, sequence_, unless, when) import Data.Bifunctor(Bifunctor(bimap, first, second)) import Data.Bool(Bool(False, True), (&&), (||), not, otherwise)@@ -12,7 +12,7 @@ import Data.Eq(Eq((==), (/=))) import Data.Foldable(Foldable(fold, foldMap, foldr, foldr', foldl, foldl', foldr1, foldl1, null, length, elem, maximum, minimum, sum, product), foldlM, for_, sequenceA_, and, or, any, all, maximumBy, minimumBy, find) import Data.Function(($), (.), const, flip, id, on)-import Data.Functor((<$>), Functor(fmap))+import Data.Functor((<$), (<$>), ($>), Functor(fmap), void) import Data.Int(Int, Int8, Int16, Int32, Int64) import Data.IntSet(IntSet) import Data.Map(Map)@@ -27,7 +27,7 @@ import Numeric(Floating, pi, exp, log, sqrt, (**), logBase, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh) -import Prelude((^), Double, FilePath, Float, Fractional((/), recip, fromRational), fromIntegral, Integral(quot, rem, div, mod, quotRem, divMod, toInteger), IO, Num((+), (-), (*), abs, signum, fromInteger, negate), read, RealFrac(properFraction, truncate, round, ceiling, floor), seq, Show(show), subtract, String, undefined)+import Prelude((^), ($!), Double, FilePath, Float, Fractional((/), recip, fromRational), fromIntegral, Integral(quot, rem, div, mod, quotRem, divMod, toInteger), Integer, IO, Num((+), (-), (*), abs, signum, fromInteger, negate), read, RealFrac(properFraction, truncate, round, ceiling, floor), seq, Show(show), subtract, String, undefined) import System.IO.Error(IOError, ioError, userError) @@ -66,12 +66,18 @@ map :: (Prelude.Functor f) => (a -> b) -> f a -> f b map = Prelude.fmap +(<&>) :: Functor f => f a -> (a -> b) -> f b+(<&>) = flip map+ groupOn :: Ord criterion => (item -> criterion) -> [item] -> [[item]] groupOn f = sort >>> group where sort = List.sortBy (compare `on` f) group = List.groupBy ((==) `on` f) +return' :: (Monad m) => a -> m a+return' = (return $!)+ scalaGroupBy :: Ord criterion => (item -> criterion) -> [item] -> [(criterion, [item])] scalaGroupBy f = (groupOn f) >>> pair where@@ -92,3 +98,12 @@ dirs <- paths |> ((map $ \x -> filepath <> "/" <> x) >>> (filterM SD.doesDirectoryExist)) children <- mapM listDirsRecursively dirs return $ dirs <> (concat children)++uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)+uncurry3 f (a, b, c) = f a b c++uncurry4 :: (a -> b -> c -> d -> e) -> ((a, b, c, d) -> e)+uncurry4 f (a, b, c, d) = f a b c d++uncurry5 :: (a -> b -> c -> d -> e -> f) -> ((a, b, c, d, e) -> f)+uncurry5 f (a, b, c, d, e) = f a b c d e