@@ -3,6 +3,7 @@ module Prelude.Maybe
3import Builtins
3import Builtins
4import Prelude.Algebra
4import Prelude.Algebra
5import Prelude.Cast
5import Prelude.Cast
6+import Prelude.Foldable
7%access public
8%access public
8%default total
9%default total
@@ -81,3 +82,7 @@ instance (Monoid a, Eq a) => Cast a (Maybe a) where
82instance (Monoid a) => Cast (Maybe a) a where
83instance (Monoid a) => Cast (Maybe a) a where
83 cast = lowerMaybe
84 cast = lowerMaybe
86+instance Foldable Maybe where
87+ foldr _ z Nothing = z
88+ foldr f z (Just x) = f x z