@@ -108,6 +108,40 @@ length (x::xs) = 1 + length xs
108(++) [] right = right
108(++) [] right = right
109(++) (x::xs) right = x :: (xs ++ right)
109(++) (x::xs) right = x :: (xs ++ right)
111+--------------------------------------------------------------------------------
113+--------------------------------------------------------------------------------
115+instance (Eq a) => Eq (List a) where
117+ (==) (x::xs) (y::ys) =
125+instance Ord a => Ord (List a) where
129+ compare (x::xs) (y::ys) =
135+instance Semigroup (List a) where
138+instance Monoid (List a) where
141+-- XXX: unification failure
142+-- instance VerifiedSemigroup (List a) where
143+-- semigroupOpIsAssociative = appendAssociative
111--------------------------------------------------------------------------------
145--------------------------------------------------------------------------------
112-- Zips and unzips
146-- Zips and unzips
113--------------------------------------------------------------------------------
147--------------------------------------------------------------------------------
@@ -171,8 +205,12 @@ foldr f e (x::xs) = f x (foldr f e xs)
171-- Special folds
205-- Special folds
172--------------------------------------------------------------------------------
206--------------------------------------------------------------------------------
208+mconcat : Monoid a => List a -> a
209+mconcat = foldr (<+>) neutral
174concat : List (List a) -> List a
211concat : List (List a) -> List a
175−concat = foldr (++) []
212+concat [] = []
213+concat (x::xs) = x ++ concat xs
177concatMap : (a -> List b) -> List a -> List b
215concatMap : (a -> List b) -> List a -> List b
178concatMap f [] = []
216concatMap f [] = []
@@ -494,40 +532,6 @@ hasAnyByNilFalse p (x::xs) =
495hasAnyNilFalse : Eq a => (l : List a) -> hasAny [] l = False
533hasAnyNilFalse : Eq a => (l : List a) -> hasAny [] l = False
496hasAnyNilFalse l = ?hasAnyNilFalseBody
534hasAnyNilFalse l = ?hasAnyNilFalseBody
498−--------------------------------------------------------------------------------
500−--------------------------------------------------------------------------------
502−instance (Eq a) => Eq (List a) where
504− (==) (x::xs) (y::ys) =
512−instance Ord a => Ord (List a) where
516− compare (x::xs) (y::ys) =
522−instance Semigroup (List a) where
525−instance Monoid (List a) where
528−-- XXX: unification failure
529−-- instance VerifiedSemigroup (List a) where
530−-- semigroupOpIsAssociative = appendAssociative
532--------------------------------------------------------------------------------
536--------------------------------------------------------------------------------
@@ -591,20 +595,21 @@ mapPreservesLengthStepCase = proof {
594−prelude.list.zipWithTailProof = proof {
598+zipWithTailProof = proof {
596 rewrite (succInjective (length xs) (length ys) p);
600 rewrite (succInjective (length xs) (length ys) p);
600−prelude.list.zipWith3TailProof = proof {
604+zipWith3TailProof = proof {
602 rewrite (succInjective (length xs) (length ys) p);
606 rewrite (succInjective (length xs) (length ys) p);
606−prelude.list.zipWith3TailProof' = proof {
610+zipWith3TailProof' = proof {
608 rewrite (succInjective (length ys) (length zs) q);
612 rewrite (succInjective (length ys) (length zs) q);