ListLike 2.0.1 → 3.0.1
raw patch · 10 files changed
+209/−199 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.ListLike.Instances: instance (Ord key, Eq val) => ListLike (Map key val) (key, val)
- Data.ListLike.Instances: instance Ord key => FoldableLL (Map key val) (key, val)
+ Data.ListLike.Instances: instance FoldableLL (Seq a) a
+ Data.ListLike.Instances: instance ListLike (Seq a) a
+ Data.ListLike.Instances: instance ListLikeIO (Seq Char) Char
+ Data.ListLike.Instances: instance StringLike (Seq Char)
Files
- COPYRIGHT +13/−25
- ListLike.cabal +2/−2
- src/Data/ListLike.hs +1/−1
- src/Data/ListLike/Base.hs +10/−1
- src/Data/ListLike/FoldableLL.hs +1/−1
- src/Data/ListLike/IO.hs +1/−1
- src/Data/ListLike/Instances.hs +126/−117
- src/Data/ListLike/String.hs +1/−1
- src/Data/ListLike/Utils.hs +1/−1
- testsrc/runtests.hs +53/−49
COPYRIGHT view
@@ -1,25 +1,13 @@-listlike-Copyright (C) 2007 John Goerzen <jgoerzen@complete.org>--All code is under the following license unless otherwise noted:- This program is free software; you can redistribute it and/or modify- it under the terms of the GNU Lesser General Public License as published by- the Free Software Foundation; either version 2.1 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU Lesser General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program; if not, write to the Free Software- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA--The GNU Lesser General Public License is available in the file COPYING in the-source distribution. Debian GNU/Linux users may find this in-/usr/share/common-licenses/LGPL-2.1.--If the LGPL is unacceptable for your uses, please e-mail me; alternative-terms can be negotiated for your project.-+Copyright (c) 2007-2010 John Goerzon and John Lato. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +
ListLike.cabal view
@@ -1,6 +1,6 @@ Name: ListLike-Version: 2.0.1-License: LGPL+Version: 3.0.1+License: BSD3 Maintainer: John Lato <jwlato@gmail.com> Author: John Goerzen Copyright: Copyright (c) 2007-2008 John Goerzen
src/Data/ListLike.hs view
@@ -10,7 +10,7 @@ {- | Module : Data.ListLike Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional
src/Data/ListLike/Base.hs view
@@ -16,7 +16,7 @@ {- | Module : Data.ListLike.Base Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional@@ -423,10 +423,19 @@ ------------------------------ Generalized functions {- | Generic version of 'nub' -} nubBy :: (item -> item -> Bool) -> full -> full+ nubBy f l = nubBy' l (empty :: full)+ where+ nubBy' ys xs+ | null ys = empty+ | any (f (head ys)) xs = nubBy' (tail ys) xs+ | otherwise = let y = head ys+ in cons y (nubBy' (tail ys) (cons y xs))+{- nubBy f l | null l = empty | otherwise = cons (head l) (nubBy f (filter (\y -> not (f (head l) y)) (tail l)))+-} {- | Generic version of 'deleteBy' -} deleteBy :: (item -> item -> Bool) -> item -> full -> full
src/Data/ListLike/FoldableLL.hs view
@@ -13,7 +13,7 @@ {- | Module : Data.ListLike.FoldableLL Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional
src/Data/ListLike/IO.hs view
@@ -14,7 +14,7 @@ {- | Module : Data.ListLike.IO Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional
src/Data/ListLike/Instances.hs view
@@ -15,7 +15,7 @@ {- | Module : Data.ListLike.Instances Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional@@ -37,20 +37,23 @@ splitAt, elem, notElem, unzip, lines, words, unlines, unwords) import qualified Data.List as L-import Data.ListLike.Base-import Data.ListLike.String-import Data.ListLike.IO-import Data.ListLike.FoldableLL-import Data.Int-import Data.Monoid+import qualified Data.Sequence as S+import Data.Sequence ((><), (|>), (<|))+import qualified Data.Foldable as F+import Data.ListLike.Base+import Data.ListLike.String+import Data.ListLike.IO+import Data.ListLike.FoldableLL+import Data.Int+import Data.Monoid import qualified Data.ByteString as BS import qualified Data.Foldable as F+import qualified Data.Traversable as T import qualified Data.Array.IArray as A-import Data.Array.IArray((!), (//), Ix(..))+import Data.Array.IArray((!), (//), Ix(..)) import qualified Data.ByteString.Lazy as BSL import qualified System.IO as IO-import Data.Word-import qualified Data.Map as Map+import Data.Word -------------------------------------------------- -- []@@ -105,12 +108,12 @@ init = BS.init null = BS.null length = BS.length- -- map = BS.map+ -- map = rigidMap = BS.map reverse = BS.reverse intersperse = BS.intersperse concat = BS.concat . toList- --concatMap = BS.concatMap+ --concatMap = rigidConcatMap = BS.concatMap any = BS.any all = BS.all@@ -302,113 +305,14 @@ -------------------------------------------------- -- Map+-- N.B. the Map instance is broken because it treats the key as part of the+-- element. Consider:+-- let m = fromList [(False,0)] :: Map Bool Int+-- let m' = cons (False, 1) m+-- m' == fromList [(False,1)] =/= [(False,1), (False,0)]+-- Map isn't a suitable candidate for ListLike... -instance (Ord key) => FoldableLL (Map.Map key val) (key, val) where- foldr f start m = Map.foldrWithKey func start m- where func k v accum = f (k, v) accum- foldl f start m = L.foldl f start (Map.toList m) -l2m :: (Ord k, Ord k2) => ([(k, v)], [(k2, v2)]) -> (Map.Map k v, Map.Map k2 v2)-l2m (l1, l2) = (Map.fromList l1, Map.fromList l2)-instance (Ord key, Eq val) => ListLike (Map.Map key val) (key, val) where- empty = Map.empty- singleton (k, v) = Map.singleton k v- cons (k, v) m = Map.insert k v m- snoc = flip cons- append = Map.union- head = Map.elemAt 0- last m = Map.elemAt (Map.size m - 1) m- -- was deleteAt 0, but that is broken in GHC 6.6- tail = drop 1- -- broken in GHC 6.6: init m = Map.deleteAt (Map.size m - 1) m- init = Map.fromAscList . L.init . Map.toAscList- null = Map.null- length = Map.size- map f = fromList . map f . Map.toList- rigidMap f = Map.fromList . L.map f . Map.toList- reverse = id- intersperse i f- | Map.size f <= 1 = f- | otherwise = cons i f- -- concat- -- concatMap- -- rigidConcatMap- -- any- -- all- -- maximum- -- minimum- replicate = genericReplicate- take n = Map.fromAscList . L.take n . Map.toAscList- drop n = Map.fromAscList . L.drop n . Map.toAscList- splitAt n = l2m . L.splitAt n . Map.toList- takeWhile f = Map.fromAscList . L.takeWhile f . Map.toAscList- dropWhile f = Map.fromAscList . L.dropWhile f . Map.toAscList- span f = l2m . L.span f . Map.toList- break f = span (not . f)- group m- | null m = empty- | otherwise = cons (singleton (head m)) (group (tail m))- -- group- -- inits- -- tails- isPrefixOf f1 f2 = L.isPrefixOf (Map.toList f1) (Map.toList f2)- isSuffixOf f1 f2 = L.isSuffixOf (Map.toList f1) (Map.toList f2)- isInfixOf = Map.isSubmapOf- --elem = Map.member- --notElem = Map.notMember- -- find- filter f m = Map.filterWithKey func m- where func k v = f (k, v)- index = flip Map.elemAt- elemIndex (k, v) m =- case Map.lookupIndex k m of- Nothing -> fail "elemIndex: no matching key"- Just i -> if snd (Map.elemAt i m) == v- then Just i- else fail "elemIndex on Map: matched key but not value"- elemIndices i m = - case elemIndex i m of- Nothing -> empty- Just x -> singleton x- -- findIndex- -- findIndices- -- sequence- -- mapM- -- rigidMapM- -- mapM_- nub = id- delete (k, v) m =- case Map.lookup k m of- Nothing -> m- Just x -> if x == v- then Map.delete k m- else m- union = Map.union- -- intersect- sort = id- insert = cons- toList = Map.toList- fromList = Map.fromList- nubBy func = Map.fromAscList . L.nubBy func . Map.toAscList- --deleteBy- deleteFirstsBy func m1 m2 = Map.fromAscList $ - L.deleteFirstsBy func (Map.toAscList m1)- (Map.toAscList m2)- --deleteFirstsBy- unionBy func m1 m2 = Map.fromList $ - L.unionBy func (Map.toList m1) (Map.toList m2)- --intersectBy- --groupBy- sortBy _ = id- insertBy _ = insert- genericLength = fromIntegral . Map.size- genericTake n = Map.fromAscList . L.genericTake n . Map.toAscList- genericDrop n = Map.fromAscList . L.genericDrop n . Map.toAscList- genericSplitAt n = l2m . L.genericSplitAt n . Map.toList- genericReplicate count item- | count <= 0 = empty- | otherwise = singleton item- -------------------------------------------------- -- Arrays @@ -545,3 +449,108 @@ -- readFile -- writeFile -- appendFile++-- ---------------------------+-- Data.Sequence instances++instance ListLikeIO (S.Seq Char) Char where+ hGetLine h = IO.hGetLine h >>= (return . fromList)+ hGetContents h = IO.hGetContents h >>= (return . fromList)+ hGet h i = ((hGet h i)::IO String) >>= (return . fromList)+ hGetNonBlocking h i = ((hGetNonBlocking h i):: IO String) >>= (return . fromList)+ hPutStr h = hPutStr h . toString+ hPutStrLn h = hPutStrLn h . toString+ getLine = IO.getLine >>= (return . fromString)+ getContents = IO.getContents >>= (return . fromString)+ putStr = IO.putStr . toString+ putStrLn = IO.putStrLn . toString+ -- interact+ -- readFile+ -- writeFile+ -- appendFile++instance StringLike (S.Seq Char) where+ toString = toList+ fromString = fromList++instance FoldableLL (S.Seq a) a where+ foldl = F.foldl+ foldl' = F.foldl'+ foldl1 = F.foldl1+ foldr = F.foldr+ foldr' = F.foldr'+ foldr1 = F.foldr1++instance ListLike (S.Seq a) a where+ empty = S.empty+ singleton = S.singleton+ cons = (<|)+ snoc = (|>)+ append = (><)+ head s = let (a S.:< _) = S.viewl s in a+ last s = let (_ S.:> a) = S.viewr s in a+ tail s = S.index (S.tails s) 1+ init s = S.index (S.inits s) (S.length s - 1)+ null = S.null+ length = S.length+ map f = fromList . toList . fmap f+ --rigidMap =+ reverse = S.reverse+ --intersperse =+ --concat =+ --concatMap = + --rigidConcatMap =+ any = F.any+ all = F.all+ maximum = F.maximum+ minimum = F.minimum+ replicate n = S.replicate (if n >= 0 then n else 0)+ take = S.take+ drop = S.drop+ splitAt = S.splitAt+ --takeWhile =+ --dropWhile =+ span = S.spanl+ -- break =+ --group =+ inits = fromList . toList . S.inits+ tails = fromList . toList . S.tails+ --isPrefixOf =+ --isSuffixOf =+ --isInfixOf =+ --elem =+ --notElem =+ --find =+ filter = S.filter+ partition = S.partition+ index = S.index+ elemIndex = S.elemIndexL+ elemIndices p = fromList . S.elemIndicesL p+ findIndex = S.findIndexL+ findIndices p = fromList . S.findIndicesL p+ --sequence =+ --mapM f =+ mapM_ = F.mapM_+ --nub =+ --delete =+ --deleteFirsts =+ --union =+ --intersect =+ sort = S.sort+ --insert = S.insert+ toList = F.toList+ fromList = S.fromList+ fromListLike = fromList . toList+ --nubBy =+ --deleteBy =+ --deleteFirstsBy =+ --unionBy =+ --intersectBy =+ --groupBy f =+ sortBy = S.sortBy+ --insertBy =+ genericLength = fromInteger . fromIntegral . S.length+ genericTake i = S.take (fromIntegral i)+ genericDrop i = S.drop (fromIntegral i)+ genericSplitAt i = S.splitAt (fromIntegral i)+ genericReplicate i = S.replicate (fromIntegral i)
src/Data/ListLike/String.hs view
@@ -10,7 +10,7 @@ {- | Module : Data.ListLike.String Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional
src/Data/ListLike/Utils.hs view
@@ -13,7 +13,7 @@ {- | Module : Data.ListLike.Utils Copyright : Copyright (C) 2007 John Goerzen- License : LGPL+ License : BSD3 Maintainer : John Goerzen <jgoerzen@complete.org> Stability : provisional
testsrc/runtests.hs view
@@ -1,3 +1,12 @@+{-# LANGUAGE ScopedTypeVariables+ ,RankNTypes+ ,ExistentialQuantification+ ,MultiParamTypeClasses+ ,FunctionalDependencies+ ,FlexibleInstances+ ,UndecidableInstances+ ,FlexibleContexts #-}+ {- Copyright (C) 2007 John Goerzen <jgoerzen@complete.org> @@ -6,15 +15,10 @@ For license and copyright information, see the file COPYRIGHT -}+module Main where import Test.QuickCheck-import Test.QuickCheck.Batch-import qualified Data.ByteString as BS-import qualified Data.Array as A-import qualified Data.ByteString.Lazy as BSL import qualified Data.ListLike as LL-import qualified Data.Map as Map-import qualified Data.Array as A import qualified Data.Foldable as F import System.Random import qualified Test.HUnit as HU@@ -52,7 +56,7 @@ prop_length2 f = checkLengths f (LL.toList f) prop_length3 f1 f2 = llcmp (LL.append f1 f2) (LL.toList f1 ++ LL.toList f2) -prop_map :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> item) -> Result+prop_map :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> item) -> Property prop_map f func = llcmp llmap (map func (LL.toList f)) where llmap = asTypeOf (LL.map func f) (LL.toList f) @@ -63,7 +67,7 @@ prop_concat f = llcmp (LL.concat f) (concat $ map LL.toList (LL.toList f)) -prop_concatmap :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> [item]) -> Result+prop_concatmap :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> [item]) -> Property prop_concatmap f func = llcmp (LL.concatMap func f) (concatMap func (LL.toList f))@@ -72,12 +76,11 @@ llcmp (LL.rigidConcatMap func f) (concatMap (LL.toList . func) (LL.toList f)) -prop_any f func = (LL.any func f) @?= (any func (LL.toList f))-prop_all f func = (LL.all func f) @?= (all func (LL.toList f))-prop_maximum f = not (LL.null f) ==> LL.maximum f @=? maximum (LL.toList f)-prop_minimum f = not (LL.null f) ==> LL.minimum f @=? minimum (LL.toList f)-prop_replicate f count i = - llcmp res (replicate count i)+prop_any f func = (LL.any func f) == (any func (LL.toList f))+prop_all f func = (LL.all func f) == (all func (LL.toList f))+prop_maximum f = not (LL.null f) ==> LL.maximum f == maximum (LL.toList f)+prop_minimum f = not (LL.null f) ==> LL.minimum f == minimum (LL.toList f)+prop_replicate f count i = count <= 1000 ==> llcmp res (replicate count i) where res = asTypeOf (LL.replicate count i) f prop_take f count = llcmp (LL.take count f) (take count (LL.toList f)) prop_drop f count = count >= 0 ==> llcmp (LL.drop count f) (drop count (LL.toList f))@@ -96,29 +99,29 @@ [break func (LL.toList f)] prop_group f = -- llcmp (map LL.toList (LL.group f)) (group (LL.toList f))- (map LL.toList (LL.group f)) @?= (group (LL.toList f))-prop_inits f = (map LL.toList (LL.inits f)) @?= (inits (LL.toList f))-prop_tails f = (map LL.toList (LL.tails f)) @?= (tails (LL.toList f))-prop_isPrefixOf f1 f2 = LL.isPrefixOf f1 f2 @?= + (map LL.toList (LL.group f)) == (group (LL.toList f))+prop_inits f = (map LL.toList (LL.inits f)) == (inits (LL.toList f))+prop_tails f = (map LL.toList (LL.tails f)) == (tails (LL.toList f))+prop_isPrefixOf f1 f2 = LL.isPrefixOf f1 f2 == (isPrefixOf (LL.toList f1) (LL.toList f2))-prop_isSuffixOf f1 f2 = LL.isSuffixOf f1 f2 @?=+prop_isSuffixOf f1 f2 = LL.isSuffixOf f1 f2 == (isSuffixOf (LL.toList f1) (LL.toList f2))-prop_isInfixOf f1 f2 = LL.isInfixOf f1 f2 @?=+prop_isInfixOf f1 f2 = LL.isInfixOf f1 f2 == (isInfixOf (LL.toList f1) (LL.toList f2))-prop_elem f i = LL.elem i f @?= elem i (LL.toList f)-prop_notElem f i = LL.notElem i f @?= notElem i (LL.toList f)-prop_find f func = LL.find func f @?= find func (LL.toList f)+prop_elem f i = LL.elem i f == elem i (LL.toList f)+prop_notElem f i = LL.notElem i f == notElem i (LL.toList f)+prop_find f func = LL.find func f == find func (LL.toList f) prop_filter f func = llcmp (LL.filter func f) (filter func (LL.toList f)) prop_partition f func = - (LL.toList f1, LL.toList f2) @?= partition func (LL.toList f)+ (LL.toList f1, LL.toList f2) == partition func (LL.toList f) where (f1, f2) = LL.partition func f prop_index f i = (i >= 0 && i < LL.length f) ==>- (LL.index f i @?= ((LL.toList f) !! i))-prop_elemIndex f i = LL.elemIndex i f @?= elemIndex i (LL.toList f)-prop_elemIndices f i = LL.elemIndices i f @?= elemIndices i (LL.toList f)-prop_findIndex f func = LL.findIndex func f @?= findIndex func (LL.toList f)+ (LL.index f i == ((LL.toList f) !! i))+prop_elemIndex f i = LL.elemIndex i f == elemIndex i (LL.toList f)+prop_elemIndices f i = LL.elemIndices i f == elemIndices i (LL.toList f)+prop_findIndex f func = LL.findIndex func f == findIndex func (LL.toList f) prop_findIndices f func =- LL.findIndices func f @?= findIndices func (LL.toList f)+ LL.findIndices func f == findIndices func (LL.toList f) prop_sequence f = case (llres, sequence testit) of@@ -127,15 +130,16 @@ where testit = map Just (LL.toList f) llres = asTypeOf (LL.sequence testit) (Just f) -prop_mapM :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> Maybe item) -> Result-prop_mapM f func = llmapM @?= (mapM func (LL.toList f))+prop_mapM :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> Maybe item) -> Bool+prop_mapM f func = llmapM == (mapM func (LL.toList f)) where llmapM = asTypeOf (LL.mapM func f) (Just (LL.toList f)) -prop_rigidMapM :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> Maybe item) -> Result+prop_rigidMapM :: forall full item. (TestLL full item, TestLL [item] item) => full -> (item -> Maybe item) -> Property prop_rigidMapM f func = case (LL.rigidMapM func f, mapM func (LL.toList f)) of- (Just ll, Just l) -> llcmp ll l- _ -> error "error in prop_rigidMapM"+ (Just ll, Just l) -> llcmp ll l+ (Nothing, Nothing) -> property True+ e -> error $ "error in prop_rigidMapM: " ++ show e -- FIXME: can we test mapM_? @@ -159,7 +163,7 @@ prop_intersectBy f1 f2 func = llcmp (LL.intersectBy func f1 f2) (intersectBy func (LL.toList f1) (LL.toList f2)) prop_groupBy f func =- (map LL.toList (LL.groupBy func f)) @?= (groupBy func (LL.toList f))+ (map LL.toList (LL.groupBy func f)) == (groupBy func (LL.toList f)) prop_sortBy1 f = llcmp (LL.sortBy compare f) (sortBy compare (LL.toList f)) prop_sortBy2 f = llcmp (LL.sortBy func f) (sortBy func (LL.toList f)) where func x y = compare y x@@ -170,7 +174,7 @@ (insertBy func i (LL.toList f)) where func x y = compare y x prop_genericLength f =- LL.genericLength f @?= genericLength (LL.toList f)+ LL.genericLength f == genericLength (LL.toList f) prop_genericTake f (i::Integer) = (i >= 0) ==> llcmp (LL.genericTake i f) (genericTake i (LL.toList f)) prop_genericDrop f (i::Integer) = (i >= 0) ==>@@ -184,10 +188,10 @@ --prop_zip :: (LL.ListLike full item, LL.ListLike result (item, Int)) => -- full -> Result-prop_zip f = LL.zip f f2 @?= zip (LL.toList f) f2+prop_zip f = LL.zip f f2 == zip (LL.toList f) f2 where f2 = [(-5::Int)..] prop_zipWith f = - LL.toList res @?= (zipWith func (LL.toList f) f2)+ LL.toList res == (zipWith func (LL.toList f) f2) where f2 = [(100::Int)..(-100)] func x y = (y + 5, x) res = asTypeOf (LL.zipWith func f f2) [(5::Int, LL.head f)]@@ -196,21 +200,21 @@ --FIXME: prop_or --FIXME: prop_sum --FIXME: prop_product-prop_foldl f func (i::Int) = LL.foldl func i f @?= foldl func i (LL.toList f)+prop_foldl f func (i::Int) = LL.foldl func i f == foldl func i (LL.toList f) prop_foldl' f func (i::Integer) =- LL.foldl' func i f @?= foldl' func i (LL.toList f)+ LL.foldl' func i f == foldl' func i (LL.toList f) prop_foldl1 f func = not (LL.null f) ==> - (LL.foldl1 func f) @?= (foldl1 func (LL.toList f))-prop_foldr f func (i::Int) = LL.foldr func i f @?= foldr func i (LL.toList f)+ (LL.foldl1 func f) == (foldl1 func (LL.toList f))+prop_foldr f func (i::Int) = LL.foldr func i f == foldr func i (LL.toList f) prop_foldr' f func (i::Integer) =- LL.foldr' func i f @?= foldr' func i (LL.toList f)+ LL.foldr' func i f == foldr' func i (LL.toList f) prop_foldr1 f func = not (LL.null f) ==>- LL.foldl1 func f @?= foldl1 func (LL.toList f)+ LL.foldl1 func f == foldl1 func (LL.toList f) prop_fold f = llcmp res resl where res = LL.fold f resl = fold (map LL.toList (LL.toList f))-prop_foldMap :: (LL.ListLike full item, Eq full) => full -> (item -> [Int]) -> Result-prop_foldMap f func = res @?= resl+prop_foldMap :: (LL.ListLike full item, Eq full) => full -> (item -> [Int]) -> Bool+prop_foldMap f func = res == resl where res = LL.foldMap func f resl = foldMap func (LL.toList f) -- asTypeOf (foldMap (LL.toList f)) (head f) @@ -218,10 +222,10 @@ ((LL.fromString . LL.toString $ f) == f) where l = LL.toList f prop_fromString f x = - LL.toString (asTypeOf (LL.fromString x) f) @?= x-prop_lines f = map LL.toString res @?= lines (LL.toString f)+ LL.toString (asTypeOf (LL.fromString x) f) == x+prop_lines f = map LL.toString res == lines (LL.toString f) where res = asTypeOf (LL.lines f) [f]-prop_words f = map LL.toString res @?= words (LL.toString f)+prop_words f = map LL.toString res == words (LL.toString f) where res = asTypeOf (LL.words f) [f] allt = [apf "empty" (t prop_empty),