utility-ht 0.0.7.1 → 0.0.8
raw patch · 6 files changed
+28/−22 lines, 6 files
Files
- src/Control/Functor/HT.hs +4/−0
- src/Data/Function/HT/Private.hs +0/−9
- src/Data/List/HT.hs +1/−0
- src/Data/List/HT/Private.hs +6/−0
- src/Data/List/Match/Private.hs +12/−10
- utility-ht.cabal +5/−3
+ src/Control/Functor/HT.hs view
@@ -0,0 +1,4 @@+module Control.Functor.HT where++void :: Functor f => f a -> f ()+void = fmap (const ())
src/Data/Function/HT/Private.hs view
@@ -43,12 +43,3 @@ powerAssociative1 op a0 a n = foldr op a0 (genericReplicate n a)---infixl 0 $%--{- |-Flipped version of '($)'.--}-($%) :: a -> (a -> b) -> b-($%) = flip ($)
src/Data/List/HT.hs view
@@ -54,6 +54,7 @@ L.padRight, L.iterateAssociative, L.iterateLeaky,+ L.lengthAtLeast, ) where import qualified Data.List.HT.Private as L
src/Data/List/HT/Private.hs view
@@ -772,6 +772,12 @@ -} +lengthAtLeast :: Int -> [a] -> Bool+lengthAtLeast n =+ if n<=0+ then const False+ else not . null . drop (n-1)+ {- Iterate until elements start to cycle. This implementation is inspired by Elements of Programming
src/Data/List/Match/Private.hs view
@@ -7,6 +7,8 @@ import qualified Data.List as List +import Control.Functor.HT (void, )+ import Prelude hiding (take, drop, splitAt, replicate, ) @@ -72,19 +74,19 @@ but more efficient. -} compareLength :: [a] -> [b] -> Ordering-compareLength (_:xs) (_:ys) = compareLength xs ys-compareLength [] [] = EQ-compareLength (_:_) [] = GT-compareLength [] (_:_) = LT+compareLength xs ys =+ compare (void xs) (void ys) -{- | efficient like compareLength, but without pattern matching -}+{- | this one uses explicit recursion -} compareLength0 :: [a] -> [b] -> Ordering-compareLength0 xs ys =- let boolList zs = replicate zs True ++ repeat False- -- we rely in the order of Bool constructors False and True here- in uncurry compare (head- (dropWhile (uncurry (&&)) (zip (boolList xs) (boolList ys))))+compareLength0 =+ let recourse (_:xs) (_:ys) = recourse xs ys+ recourse [] [] = EQ+ recourse (_:_) [] = GT+ recourse [] (_:_) = LT+ in recourse +{- | strict comparison -} compareLength1 :: [a] -> [b] -> Ordering compareLength1 xs ys = compare (length xs) (length ys)
utility-ht.cabal view
@@ -1,5 +1,5 @@ Name: utility-ht-Version: 0.0.7.1+Version: 0.0.8 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -19,7 +19,8 @@ However, further splitting the base package might invalidate this statement. . Alternative packages: @Useful@, @MissingH@-Tested-With: GHC==6.8.2, GHC==6.10.4, GHC==6.12.3, GHC==7.0.2+Tested-With: GHC==6.8.2, GHC==6.10.4, GHC==6.12.3+Tested-With: GHC==7.0.2, GHC==7.2.2 Cabal-Version: >=1.10 Build-Type: Simple @@ -39,7 +40,7 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/utility/- tag: 0.0.7.1+ tag: 0.0.8 Library Build-Depends:@@ -63,6 +64,7 @@ Data.String.HT Data.Tuple.HT Control.Monad.HT+ Control.Functor.HT Data.Strictness.HT Text.Read.HT Text.Show.HT