Skip to content

Commit d89ce9a

Browse files
MonoPointed version of MonoUnfold and MonoUnfold1
1 parent eee60a0 commit d89ce9a

2 files changed

Lines changed: 123 additions & 75 deletions

File tree

mono-traversable/src/Data/MonoTraversable.hs

Lines changed: 98 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ import qualified Data.Vector.Unboxed as U
9595
import qualified Data.Vector.Storable as VS
9696
import qualified Data.IntSet as IntSet
9797
import Data.Semigroup
98-
( Semigroup
98+
( Semigroup ((<>))
99+
, Endo (Endo)
99100
-- Option has been removed in base-4.16 (GHC 9.2)
100101
#if !MIN_VERSION_base(4,16,0)
101102
, Option (..)
@@ -172,6 +173,7 @@ type instance Element (Par1 a) = a
172173
type instance Element (U1 a) = a
173174
type instance Element (V1 a) = a
174175
type instance Element (Proxy a) = a
176+
type instance Element (Endo mono) = Element mono
175177

176178
-- | Monomorphic containers that can be mapped over.
177179
class MonoFunctor mono where
@@ -996,90 +998,129 @@ minimumByMay f mono
996998
class MonoUnfold mono where
997999
unfoldrM :: Monad m => (a -> m (Maybe (Element mono, a))) -> a -> m mono
9981000
unfoldrNM :: Monad m => Int -> (a -> m (Maybe (Element mono, a))) -> a -> m mono
999-
unfoldrNM' :: Monad m => Int -> (a -> m ( (Element mono, a))) -> a -> m mono
1001+
unfoldrExactNM :: Monad m => Int -> (a -> m ( (Element mono, a))) -> a -> m mono
10001002
unfoldlM :: Monad m => (a -> m (Maybe (a, Element mono))) -> a -> m mono
10011003
unfoldlNM :: Monad m => Int -> (a -> m (Maybe (a, Element mono))) -> a -> m mono
1002-
unfoldlNM' :: Monad m => Int -> (a -> m ( (a, Element mono))) -> a -> m mono
1004+
unfoldlExactNM :: Monad m => Int -> (a -> m ( (a, Element mono))) -> a -> m mono
10031005

10041006
unfoldr :: MonoUnfold mono => (a -> Maybe (Element mono, a)) -> a -> mono
10051007
unfoldr = wrapIdentity unfoldrM
10061008
unfoldrN :: MonoUnfold mono => Int -> (a -> Maybe (Element mono, a)) -> a -> mono
10071009
unfoldrN = wrapIdentity . unfoldrNM
1008-
unfoldrN' :: MonoUnfold mono => Int -> (a -> (Element mono, a)) -> a -> mono
1009-
unfoldrN' = wrapIdentity . unfoldrNM'
1010+
unfoldrExactN :: MonoUnfold mono => Int -> (a -> (Element mono, a)) -> a -> mono
1011+
unfoldrExactN = wrapIdentity . unfoldrExactNM
10101012
unfoldl :: MonoUnfold mono => (a -> Maybe (a, Element mono)) -> a -> mono
10111013
unfoldl = wrapIdentity unfoldlM
10121014
unfoldlN :: MonoUnfold mono => Int -> (a -> Maybe (a, Element mono)) -> a -> mono
10131015
unfoldlN = wrapIdentity . unfoldlNM
1014-
unfoldlN' :: MonoUnfold mono => Int -> (a -> (a, Element mono)) -> a -> mono
1015-
unfoldlN' = wrapIdentity . unfoldlNM'
1016+
unfoldlExactN :: MonoUnfold mono => Int -> (a -> (a, Element mono)) -> a -> mono
1017+
unfoldlExactN = wrapIdentity . unfoldlExactNM
10161018

10171019
wrapIdentity :: ((a -> Identity b) -> c -> Identity d) -> (a -> b) -> c -> d
10181020
wrapIdentity f g = runIdentity . f (Identity . g)
10191021

1020-
instance MonoUnfold [a] where
1021-
unfoldrM f x = f x >>= maybe (pure []) (\(y,x) -> (y :) <$> unfoldrM f x)
1022-
unfoldrNM n f x | n > 0 = f x >>= maybe (pure []) (\(y,x) -> (y :) <$> unfoldrNM (n - 1) f x)
1023-
| otherwise = pure []
1024-
unfoldrNM' n f x | n > 0 = f x >>= \(y,x) -> (y :) <$> unfoldrNM' (n - 1) f x
1025-
| otherwise = pure []
1026-
unfoldlM f = fmap ($ []) . g
1027-
where g x = f x >>= maybe (pure id) (\(y,z) -> g y <&> (. (z :)))
1028-
unfoldlNM n f = fmap ($ []) . g n
1029-
where g n x | n > 0 = f x >>= maybe (pure id) (\(y,z) -> g (n - 1) y <&> (. (z :)))
1022+
instance {-# OVERLAPPABLE #-} (Monoid a, MonoPointed a) => MonoUnfold a where
1023+
unfoldrM f x = f x >>= maybe (pure mempty) (\(y,x) -> (opoint y <>) <$> unfoldrM f x)
1024+
unfoldrNM n f x | n > 0 = f x >>= maybe (pure mempty) (\(y,x) -> (opoint y <>) <$> unfoldrNM (n - 1) f x)
1025+
| otherwise = pure mempty
1026+
unfoldrExactNM n f x | n > 0 = f x >>= \(y,x) -> (opoint y <>) <$> unfoldrExactNM (n - 1) f x
1027+
| otherwise = pure mempty
1028+
unfoldlM f = fmap ($ mempty) . g
1029+
where g x = f x >>= maybe (pure id) (\(y,z) -> g y <&> (. (opoint z <>)))
1030+
unfoldlNM n f = fmap ($ mempty) . g n
1031+
where g n x | n > 0 = f x >>= maybe (pure id) (\(y,z) -> g (n - 1) y <&> (. (opoint z <>)))
10301032
| otherwise = pure id
1031-
unfoldlNM' n f = fmap ($ []) . g n
1032-
where g n x | n > 0 = f x >>= \(x,y) -> g (n - 1) x <&> (. (y :))
1033+
unfoldlExactNM n f = fmap ($ mempty) . g n
1034+
where g n x | n > 0 = f x >>= \(x,y) -> g (n - 1) x <&> (. (opoint y <>))
10331035
| otherwise = pure id
1036+
--instance {-# OVERLAPPING #-} MonoUnfold (V.Vector a) where
1037+
-- unfoldrM = V.unfoldrM
1038+
-- unfoldrNM = V.unfoldrNM
1039+
-- unfoldrExactNM = V.unfoldrExactNM
1040+
1041+
--instance MonoUnfold (Endo [a]) where
1042+
-- unfoldrM f x = f x >>= maybe (pure mempty) (\(y,x) -> (Endo (y :) <>) <$> unfoldrM f x)
1043+
-- unfoldrNM n f x | n > 0 = f x >>= maybe (pure mempty) (\(y,x) -> (Endo (y :) <>) <$> unfoldrNM (n - 1) f x)
1044+
-- | otherwise = pure mempty
1045+
-- unfoldrExactNM n f x | n > 0 = f x >>= \(y,x) -> (Endo (y :) <>) <$> unfoldrExactNM (n - 1) f x
1046+
-- | otherwise = pure mempty
1047+
-- unfoldlM f = fmap ($ mempty) . g
1048+
-- where g x = f x >>= maybe (pure id) (\(y,z) -> g y <&> (. (Endo (z :) <>)))
1049+
-- unfoldlNM n f = fmap ($ mempty) . g n
1050+
-- where g n x | n > 0 = f x >>= maybe (pure id) (\(y,z) -> g (n - 1) y <&> (. (Endo (z :) <>)))
1051+
-- | otherwise = pure id
1052+
-- unfoldlExactNM n f = fmap ($ mempty) . g n
1053+
-- where g n x | n > 0 = f x >>= \(x,y) -> g (n - 1) x <&> (. (Endo (y :) <>))
1054+
-- | otherwise = pure id
1055+
--instance MonoUnfold [a] where
1056+
-- unfoldrM f x = f x >>= maybe (pure []) (\(y,x) -> (y :) <$> unfoldrM f x)
1057+
-- unfoldrNM n f x | n > 0 = f x >>= maybe (pure []) (\(y,x) -> (y :) <$> unfoldrNM (n - 1) f x)
1058+
-- | otherwise = pure []
1059+
-- unfoldrExactNM n f x | n > 0 = f x >>= \(y,x) -> (y :) <$> unfoldrExactNM (n - 1) f x
1060+
-- | otherwise = pure []
1061+
-- unfoldlM f = fmap ($ []) . g
1062+
-- where g x = f x >>= maybe (pure id) (\(y,z) -> g y <&> (. (z :)))
1063+
-- unfoldlNM n f = fmap ($ []) . g n
1064+
-- where g n x | n > 0 = f x >>= maybe (pure id) (\(y,z) -> g (n - 1) y <&> (. (z :)))
1065+
-- | otherwise = pure id
1066+
-- unfoldlExactNM n f = fmap ($ []) . g n
1067+
-- where g n x | n > 0 = f x >>= \(x,y) -> g (n - 1) x <&> (. (y :))
1068+
-- | otherwise = pure id
10341069

10351070
class MonoUnfold1 mono where
10361071
unfoldr1M :: Monad m => (a -> m (Element mono, Maybe a)) -> a -> m mono
10371072
unfoldr1NM :: Monad m => Int -> (a -> m (Element mono, Maybe a)) -> a -> m mono
1038-
unfoldr1NM' :: Monad m => Int -> (a -> m (Element mono, a)) -> a -> m mono
1073+
unfoldr1ExactNM :: Monad m => Int -> (a -> m (Element mono, a)) -> a -> m mono
10391074
unfoldl1M :: Monad m => (a -> m (Maybe a, Element mono)) -> a -> m mono
10401075
unfoldl1NM :: Monad m => Int -> (a -> m (Maybe a, Element mono)) -> a -> m mono
1041-
unfoldl1NM' :: Monad m => Int -> (a -> m ( a, Element mono)) -> a -> m mono
1076+
unfoldl1ExactNM :: Monad m => Int -> (a -> m ( a, Element mono)) -> a -> m mono
10421077

10431078
unfoldr1 :: MonoUnfold1 mono => (a -> (Element mono, Maybe a)) -> a -> mono
10441079
unfoldr1 = wrapIdentity unfoldr1M
10451080
unfoldr1N :: MonoUnfold1 mono => Int -> (a -> (Element mono, Maybe a)) -> a -> mono
10461081
unfoldr1N = wrapIdentity . unfoldr1NM
1047-
unfoldr1N' :: MonoUnfold1 mono => Int -> (a -> (Element mono, a)) -> a -> mono
1048-
unfoldr1N' = wrapIdentity . unfoldr1NM'
1082+
unfoldr1ExactN :: MonoUnfold1 mono => Int -> (a -> (Element mono, a)) -> a -> mono
1083+
unfoldr1ExactN = wrapIdentity . unfoldr1ExactNM
10491084
unfoldl1 :: MonoUnfold1 mono => (a -> (Maybe a, Element mono)) -> a -> mono
10501085
unfoldl1 = wrapIdentity unfoldl1M
10511086
unfoldl1N :: MonoUnfold1 mono => Int -> (a -> (Maybe a, Element mono)) -> a -> mono
10521087
unfoldl1N = wrapIdentity . unfoldl1NM
1053-
unfoldl1N' :: MonoUnfold1 mono => Int -> (a -> ( a, Element mono)) -> a -> mono
1054-
unfoldl1N' = wrapIdentity . unfoldl1NM'
1055-
1056-
instance MonoUnfold1 (NonEmpty a) where
1057-
unfoldr1M f x = g f (NE.:|) (:) x
1058-
where
1059-
g :: Monad m => (b -> m (a, Maybe b)) -> (a -> [a] -> f a) -> (a -> [a] -> [a]) -> b -> m (f a)
1060-
g f cons cons' x = f x >>= \(y,mx) -> cons y <$> maybe (pure []) (g f cons' cons') mx
1061-
unfoldr1NM n f x = g f (NE.:|) (:) n x
1062-
where
1063-
g :: Monad m => (b -> m (a, Maybe b)) -> (a -> [a] -> f a) -> (a -> [a] -> [a]) -> Int -> b -> m (f a)
1064-
g f cons cons' n x = f x >>= \(y,mx) -> cons y <$> maybe (pure []) (g f cons' cons' (n - 1)) (bool Nothing mx (n > 1))
1065-
unfoldr1NM' n f x = g f (NE.:|) (:) n x
1066-
where
1067-
g :: Monad m => (b -> m (a, b)) -> (a -> [a] -> f a) -> (a -> [a] -> [a]) -> Int -> b -> m (f a)
1068-
g f cons cons' n x = f x >>= \(y,x) -> cons y <$> bool (pure []) (g f cons' cons' (n - 1) x) (n > 1)
1069-
unfoldl1M f x = g x <&> \(y,h) -> y NE.:| h []
1070-
where g x = f x >>= \(mx,y) -> maybe (pure (y,id)) (\x -> g x <&> fmap (. (y :))) mx
1071-
unfoldl1NM n f x = g n x <&> \(y,h) -> y NE.:| h []
1072-
where g n x = f x >>= \(mx,y) -> maybe (pure (y,id)) (\x -> g (n - 1) x <&> fmap (. (y :))) (bool Nothing mx (n > 1))
1073-
unfoldl1NM' n f x = g n x <&> \(y,h) -> y NE.:| h []
1074-
where g n x = f x >>= \(x,y) -> bool (pure (y,id)) (g (n - 1) x <&> fmap (. (y :))) (n > 1)
1075-
1076-
instance MonoUnfold1 [a] where
1077-
unfoldr1M f = fmap NE.toList . unfoldr1M f
1078-
unfoldr1NM n f = fmap NE.toList . unfoldr1NM n f
1079-
unfoldr1NM' n f = fmap NE.toList . unfoldr1NM' n f
1080-
unfoldl1M f = fmap NE.toList . unfoldl1M f
1081-
unfoldl1NM n f = fmap NE.toList . unfoldl1NM n f
1082-
unfoldl1NM' n f = fmap NE.toList . unfoldl1NM' n f
1088+
unfoldl1ExactN :: MonoUnfold1 mono => Int -> (a -> ( a, Element mono)) -> a -> mono
1089+
unfoldl1ExactN = wrapIdentity . unfoldl1ExactNM
1090+
1091+
instance {-# OVERLAPPABLE #-} (MonoPointed a, Semigroup a) => MonoUnfold1 a where
1092+
unfoldr1M f x = f x >>= \(y,mx) -> maybe (pure $ opoint y) (fmap (opoint y <>) . unfoldr1M f) mx
1093+
unfoldr1NM n f x = f x >>= \(y,mx) -> maybe (pure $ opoint y) (fmap (opoint y <>) . unfoldr1NM (n - 1) f) (bool Nothing mx (n > 1))
1094+
unfoldr1ExactNM n f x = f x >>= \(y,x) -> bool (pure $ opoint y) ((opoint y <>) <$> unfoldr1ExactNM (n - 1) f x) (n > 1)
1095+
unfoldl1M f x = f x >>= \(mx,y) -> maybe (pure $ opoint y) (fmap (<> opoint y) . unfoldl1M f) mx
1096+
unfoldl1NM n f x = f x >>= \(mx,y) -> maybe (pure $ opoint y) (fmap (<> opoint y) . unfoldl1NM (n - 1) f) $ bool Nothing mx (n > 1)
1097+
unfoldl1ExactNM n f x = f x >>= \(x,y) -> bool (pure $ opoint y) (fmap (<> opoint y) $ unfoldl1ExactNM (n - 1) f x) (n > 1)
1098+
--instance MonoUnfold1 (NonEmpty a) where
1099+
-- unfoldr1M f x = g f (NE.:|) (:) x
1100+
-- where
1101+
-- g :: Monad m => (b -> m (a, Maybe b)) -> (a -> [a] -> f a) -> (a -> [a] -> [a]) -> b -> m (f a)
1102+
-- g f cons cons' x = f x >>= \(y,mx) -> cons y <$> maybe (pure []) (g f cons' cons') mx
1103+
-- unfoldr1NM n f x = g f (NE.:|) (:) n x
1104+
-- where
1105+
-- g :: Monad m => (b -> m (a, Maybe b)) -> (a -> [a] -> f a) -> (a -> [a] -> [a]) -> Int -> b -> m (f a)
1106+
-- g f cons cons' n x = f x >>= \(y,mx) -> cons y <$> maybe (pure []) (g f cons' cons' (n - 1)) (bool Nothing mx (n > 1))
1107+
-- unfoldr1ExactNM n f x = g f (NE.:|) (:) n x
1108+
-- where
1109+
-- g :: Monad m => (b -> m (a, b)) -> (a -> [a] -> f a) -> (a -> [a] -> [a]) -> Int -> b -> m (f a)
1110+
-- g f cons cons' n x = f x >>= \(y,x) -> cons y <$> bool (pure []) (g f cons' cons' (n - 1) x) (n > 1)
1111+
-- unfoldl1M f x = g x <&> \(y,h) -> y NE.:| h []
1112+
-- where g x = f x >>= \(mx,y) -> maybe (pure (y,id)) (\x -> g x <&> fmap (. (y :))) mx
1113+
-- unfoldl1NM n f x = g n x <&> \(y,h) -> y NE.:| h []
1114+
-- where g n x = f x >>= \(mx,y) -> maybe (pure (y,id)) (\x -> g (n - 1) x <&> fmap (. (y :))) (bool Nothing mx (n > 1))
1115+
-- unfoldl1ExactNM n f x = g n x <&> \(y,h) -> y NE.:| h []
1116+
-- where g n x = f x >>= \(x,y) -> bool (pure (y,id)) (g (n - 1) x <&> fmap (. (y :))) (n > 1)
1117+
--instance MonoUnfold1 [a] where
1118+
-- unfoldr1M f = fmap NE.toList . unfoldr1M f
1119+
-- unfoldr1NM n f = fmap NE.toList . unfoldr1NM n f
1120+
-- unfoldr1ExactNM n f = fmap NE.toList . unfoldr1ExactNM n f
1121+
-- unfoldl1M f = fmap NE.toList . unfoldl1M f
1122+
-- unfoldl1NM n f = fmap NE.toList . unfoldl1NM n f
1123+
-- unfoldl1ExactNM n f = fmap NE.toList . unfoldl1ExactNM n f
10831124

10841125
-- | Monomorphic containers that can be traversed from left to right.
10851126
--
@@ -1344,6 +1385,10 @@ instance MonoPointed (Tree a) where
13441385
instance (Applicative f, Applicative g) => MonoPointed ((f :+: g) a) where
13451386
opoint = R1 . pure
13461387
{-# INLINE opoint #-}
1388+
-- | @since ????????????
1389+
instance (MonoPointed mono, Semigroup mono) => MonoPointed (Endo mono) where
1390+
opoint = Endo . (<>) . opoint
1391+
{-# INLINE opoint #-}
13471392

13481393

13491394
-- | Typeclass for monomorphic containers where it is always okay to

mono-traversable/test/Main.hs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Data.Containers
1414
import Data.Sequences
1515
import qualified Data.Sequence as Seq
1616
import qualified Data.NonNull as NN
17-
import Data.Monoid (mempty, mconcat, (<>))
17+
import Data.Monoid (mempty, mconcat, (<>), Endo(Endo))
1818
import Data.Maybe (fromMaybe)
1919
import qualified Data.List as List
2020

@@ -557,8 +557,8 @@ main = hspec $ do
557557
headMay (Seq.fromList [] :: Seq.Seq Int) @?= Nothing
558558

559559
describe "MonoUnfold" $ do
560-
let test typ dummy = describe typ $ do
561-
let fromList' = (`fromListAs` dummy)
560+
let test :: (Arbitrary (Element mono), MonoUnfold mono, Eq mono, Show mono, Show (Element mono)) => String -> ([Element mono] -> mono) -> Spec
561+
test typ fromList' = describe typ $ do
562562
let headTailMay xs = case xs of
563563
x:xs -> Just (x,xs)
564564
[] -> Nothing
@@ -567,17 +567,18 @@ main = hspec $ do
567567
let headTailSwap = swap . headTail
568568
prop "unfoldr" $ \xs -> unfoldr headTailMay xs @?= fromList' xs
569569
prop "unfoldrN" $ \(n,xs) -> unfoldrN n headTailMay xs @?= fromList' (take n xs)
570-
prop "unfoldrN'" $ \(n, InfiniteList xs _) -> unfoldrN' n headTail xs @?= fromList' (take n xs)
570+
prop "unfoldrExactN" $ \(n, InfiniteList xs _) -> unfoldrExactN n headTail xs @?= fromList' (take n xs)
571571
prop "unfoldl" $ \xs -> unfoldl headTailMaySwap xs @?= fromList' (reverse xs)
572572
prop "unfoldlN" $ \(n,xs) -> unfoldlN n headTailMaySwap xs @?= fromList' (reverse (take n xs))
573-
prop "unfoldlN'" $ \(n,InfiniteList xs _) -> unfoldlN' n headTailSwap xs @?= fromList' (reverse (take n xs))
574-
test "List" ([] :: [Int])
575-
--test "Vector" (V.empty :: V.Vector Int)
576-
--test "Storable Vector" (VS.empty :: VS.Vector Int)
577-
--test "Unboxed Vector" (U.empty :: U.Vector Int)
578-
--test "Strict ByteString" S.empty
579-
--test "Lazy ByteString" L.empty
580-
--test "Strict Text" T.empty
573+
prop "unfoldlExactN" $ \(n,InfiniteList xs _) -> unfoldlExactN n headTailSwap xs @?= fromList' (reverse (take n xs))
574+
test "Endo" (Prelude.foldr (\x f -> Endo (x :) <> f) mempty :: [Int] -> Endo [Int])
575+
test "List" (id :: [Int] -> [Int])
576+
test "Vector" (V.fromList :: [Int] -> V.Vector Int)
577+
test "Storable Vector" (VS.fromList :: [Int] -> VS.Vector Int)
578+
test "Unboxed Vector" (U.fromList :: [Int] -> U.Vector Int)
579+
test "Strict ByteString" S.pack
580+
test "Lazy ByteString" L.pack
581+
test "Strict Text" T.pack
581582

582583
describe "MonoUnfold1" $ do
583584
let test :: (Arbitrary (Element mono), MonoUnfold1 mono, Eq mono, Show mono, Show (Element mono)) => String -> ([Element mono] -> mono) -> Spec
@@ -591,17 +592,19 @@ main = hspec $ do
591592
let take1 n = take (bool 1 n (n >= 1))
592593
prop "unfoldr1" $ \(QCM.NonEmpty xs) -> unfoldr1 headTailMay xs @?= fromList' xs
593594
prop "unfoldr1N" $ \(n, QCM.NonEmpty xs) -> unfoldr1N n headTailMay xs @?= fromList' (take1 n xs)
594-
prop "unfoldr1N'" $ \(n, InfiniteList xs _) -> unfoldr1N' n headTail xs @?= fromList' (take1 n xs)
595+
prop "unfoldr1ExactN" $ \(n, InfiniteList xs _) -> unfoldr1ExactN n headTail xs @?= fromList' (take1 n xs)
595596
prop "unfoldl1" $ \(QCM.NonEmpty xs) -> unfoldl1 headTailMaySwap xs @?= fromList' (reverse xs)
596597
prop "unfoldl1N" $ \(n, QCM.NonEmpty xs) -> unfoldl1N n headTailMaySwap xs @?= fromList' (reverse (take1 n xs))
597-
prop "unfoldl1N'" $ \(n,InfiniteList xs _) -> unfoldl1N' n headTailSwap xs @?= fromList' (reverse (take1 n xs))
598+
prop "unfoldl1ExactN" $ \(n,InfiniteList xs _) -> unfoldl1ExactN n headTailSwap xs @?= fromList' (reverse (take1 n xs))
598599
test "List" (id :: [Int] -> [Int])
599600
test "NonEmpty" (NE.fromList :: [Int] -> NE.NonEmpty Int)
600-
--test "Vector" (V.empty :: V.Vector Int)
601-
--test "Storable Vector" (VS.empty :: VS.Vector Int)
602-
--test "Unboxed Vector" (U.empty :: U.Vector Int)
603-
--test "Strict ByteString" S.empty
604-
--test "Lazy ByteString" L.empty
605-
--test "Strict Text" T.empty
606-
--test "Lazy Text" TL.empty-test "Lazy Text" TL.empty
607-
--
601+
test "Vector" (V.fromList :: [Int] -> V.Vector Int)
602+
test "Storable Vector" (VS.fromList :: [Int] -> VS.Vector Int)
603+
test "Unboxed Vector" (U.fromList :: [Int] -> U.Vector Int)
604+
test "Strict ByteString" S.pack
605+
test "Lazy ByteString" L.pack
606+
test "Strict Text" T.pack
607+
test "Lazy Text" TL.pack
608+
609+
instance Eq (Endo [Int]) where Endo f == Endo g = f mempty == g mempty
610+
instance Show (Endo [Int]) where show (Endo f) = "Endo " <> show (f mempty)

0 commit comments

Comments
 (0)