@@ -2,6 +2,7 @@ module prelude.list
3import builtins
3import builtins
5import prelude.maybe
6import prelude.maybe
6import prelude.nat
7import prelude.nat
@@ -434,28 +435,6 @@ catMaybes (x::xs) =
434 Nothing => catMaybes xs
435 Nothing => catMaybes xs
435 Just j => j :: catMaybes xs
436 Just j => j :: catMaybes xs
437−--------------------------------------------------------------------------------
439−--------------------------------------------------------------------------------
441−instance (Eq a) => Eq (List a) where
443− (==) (a::restA) (b::restB) =
450−instance Ord a => Ord (List a) where
454− compare (a::restA) (b::restB) =
457− else compare restA restB
459--------------------------------------------------------------------------------
438--------------------------------------------------------------------------------
460-- Properties
439-- Properties
461--------------------------------------------------------------------------------
440--------------------------------------------------------------------------------
@@ -469,7 +448,7 @@ appendNilRightNeutral (x::xs) =
469 ?appendNilRightNeutralStepCase
448 ?appendNilRightNeutralStepCase
471appendAssociative : (l : List a) -> (c : List a) -> (r : List a) ->
450appendAssociative : (l : List a) -> (c : List a) -> (r : List a) ->
472− (l ++ c) ++ r = l ++ (c ++ r)
451+ l ++ (c ++ r) = (l ++ c) ++ r
473appendAssociative [] c r = refl
452appendAssociative [] c r = refl
474appendAssociative (x::xs) c r =
453appendAssociative (x::xs) c r =
475 let inductiveHypothesis = appendAssociative xs c r in
454 let inductiveHypothesis = appendAssociative xs c r in
@@ -515,6 +494,40 @@ hasAnyByNilFalse p (x::xs) =
516hasAnyNilFalse : Eq a => (l : List a) -> hasAny [] l = False
495hasAnyNilFalse : Eq a => (l : List a) -> hasAny [] l = False
517hasAnyNilFalse l = ?hasAnyNilFalseBody
496hasAnyNilFalse 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
519--------------------------------------------------------------------------------
532--------------------------------------------------------------------------------
@@ -595,4 +608,3 @@ prelude.list.zipWith3TailProof' = proof {
595 rewrite (succInjective (length ys) (length zs) q);
608 rewrite (succInjective (length ys) (length zs) q);