utility-ht 0.0.13 → 0.0.14
raw patch · 5 files changed
+58/−3 lines, 5 files
Files
- src/Control/Applicative/HT.hs +38/−0
- src/Data/List/HT.hs +1/−0
- src/Data/List/HT/Private.hs +11/−0
- src/Data/Tuple/HT.hs +6/−0
- utility-ht.cabal +2/−3
src/Control/Applicative/HT.hs view
@@ -12,18 +12,56 @@ mapTriple fgh = Tuple.uncurry3 (liftA3 (,,)) . Tuple.mapTriple fgh +{-# INLINE lift #-}+lift :: Applicative m => (a -> r) -> m a -> m r+lift = fmap++{-# INLINE lift2 #-}+lift2 ::+ Applicative m => (a -> b -> r) -> m a -> m b -> m r+lift2 = liftA2++{-# INLINE lift3 #-}+lift3 ::+ Applicative m => (a -> b -> c -> r) -> m a -> m b -> m c -> m r+lift3 = liftA3++{-# INLINE lift4 #-}+lift4 ::+ Applicative m =>+ (a -> b -> c -> d -> r) -> m a -> m b -> m c -> m d -> m r+lift4 fn a b c d = fn <$> a <*> b <*> c <*> d++{-# INLINE lift5 #-}+lift5 ::+ Applicative m =>+ (a -> b -> c -> d -> e -> r) ->+ m a -> m b -> m c -> m d -> m e -> m r+lift5 fn a b c d e = fn <$> a <*> b <*> c <*> d <*> e++{-# INLINE lift6 #-}+lift6 ::+ Applicative m =>+ (a -> b -> c -> d -> e -> f -> r) ->+ m a -> m b -> m c -> m d -> m e -> m f -> m r+lift6 fn a b c d e f = fn <$> a <*> b <*> c <*> d <*> e <*> f+++{-# DEPRECATED liftA4 "use App.lift4" #-} {-# INLINE liftA4 #-} liftA4 :: Applicative f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e liftA4 f a b c d = f <$> a <*> b <*> c <*> d +{-# DEPRECATED liftA5 "use App.lift5" #-} {-# INLINE liftA5 #-} liftA5 :: Applicative f => (a -> b -> c -> d -> e -> g) -> f a -> f b -> f c -> f d -> f e -> f g liftA5 f a b c d e = f <$> a <*> b <*> c <*> d <*> e +{-# DEPRECATED liftA6 "use App.lift6" #-} {-# INLINE liftA6 #-} liftA6 :: Applicative f => (a -> b -> c -> d -> e -> g -> h) ->
src/Data/List/HT.hs view
@@ -35,6 +35,7 @@ L.maybeSuffixOf, L.partitionMaybe, L.takeWhileJust,+ L.dropWhileNothing, L.unzipEithers, -- * Sieve and slice L.sieve,
src/Data/List/HT/Private.hs view
@@ -566,6 +566,17 @@ Example: Keep the heads of sublists until an empty list occurs. > takeWhileJust $ map (fmap fst . viewL) xs+++For consistency with 'takeWhile',+'partitionMaybe' and 'dropWhileNothing' it should have been:++> takeWhileJust_ :: (a -> Maybe b) -> a -> [b]++However, both variants are interchangeable:++> takeWhileJust_ f == takeWhileJust . map f+> takeWhileJust == takeWhileJust_ id -} takeWhileJust :: [Maybe a] -> [a] takeWhileJust =
src/Data/Tuple/HT.hs view
@@ -48,6 +48,12 @@ curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d curry3 f a b c = f (a,b,c) +{- |+This is convenient for quick hacks+but I suggest that you better define a type for an ordered pair+for your application at hand.+This way, you can clearly see from the type that a pair is ordered.+-} sortPair, _sortPairMinMax :: (Ord a) => (a,a) -> (a,a) sortPair (x,y) = if x<=y then (x,y) else (y,x) _sortPairMinMax (x,y) = (min x y, max x y)
utility-ht.cabal view
@@ -1,10 +1,9 @@ Name: utility-ht-Version: 0.0.13+Version: 0.0.14 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de> Maintainer: Henning Thielemann <haskell@henning-thielemann.de>--- Homepage: http://www.haskell.org/haskellwiki/Utility-HT Category: Data, List Synopsis: Various small helper functions for Lists, Maybes, Tuples, Functions Description:@@ -45,7 +44,7 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/utility/- tag: 0.0.13+ tag: 0.0.14 Library Build-Depends: