Commit 26e424d8 authored by Steffen Michels's avatar Steffen Michels

make member of Foldable class usable with unique states

parent e444f984
Pipeline #16470 passed with stage
in 2 minutes and 49 seconds
...@@ -51,25 +51,25 @@ class Foldable t where ...@@ -51,25 +51,25 @@ class Foldable t where
* Right-associative fold of a structure. * Right-associative fold of a structure.
* `foldr f z = 'StdList'.{{foldr}} f z {{o}} {{toList}}` * `foldr f z = 'StdList'.{{foldr}} f z {{o}} {{toList}}`
*/ */
foldr :: (a b -> b) b !(t a) -> b foldr :: (a .b -> .b) .b !(t a) -> .b
/** /**
* Right-associative fold of a structure, but with strict application of * Right-associative fold of a structure, but with strict application of
* the operator. * the operator.
*/ */
foldr` :: (a b -> b) !b !(t a) -> b foldr` :: (a .b -> .b) !.b !(t a) -> .b
/** /**
* Left-associative fold of a structure. * Left-associative fold of a structure.
* `foldl f z = 'StdList'.{{foldl}} f z o {{toList}}` * `foldl f z = 'StdList'.{{foldl}} f z o {{toList}}`
*/ */
foldl :: (b a -> b) b !(t a) -> b foldl :: (.b -> .(a -> .b)) .b !(t a) -> .b
/** /**
* Left-associative fold of a structure, but with strict application of the * Left-associative fold of a structure, but with strict application of the
* operator. * operator.
*/ */
foldl` :: (b a -> b) !b !(t a) -> b foldl` :: (.b -> .(a -> .b)) !.b !(t a) -> .b
/** /**
* A variant of {{foldr}} that has no base case, and thus may only be * A variant of {{foldr}} that has no base case, and thus may only be
......
...@@ -41,7 +41,7 @@ instance Monoid () ...@@ -41,7 +41,7 @@ instance Monoid ()
:: Last a = Last (Maybe a) :: Last a = Last (Maybe a)
instance Semigroup (Dual a) | Semigroup a instance Semigroup (Dual a) | Semigroup a
instance Semigroup (Endo a) instance Semigroup (Endo .a)
instance Semigroup All instance Semigroup All
instance Semigroup Any instance Semigroup Any
instance Semigroup (Sum a) | + a & zero a instance Semigroup (Sum a) | + a & zero a
...@@ -50,7 +50,7 @@ instance Semigroup (First a) ...@@ -50,7 +50,7 @@ instance Semigroup (First a)
instance Semigroup (Last a) instance Semigroup (Last a)
instance Monoid (Dual a) | Monoid a instance Monoid (Dual a) | Monoid a
instance Monoid (Endo a) instance Monoid (Endo .a)
instance Monoid All instance Monoid All
instance Monoid Any instance Monoid Any
instance Monoid (Sum a) | + a & zero a instance Monoid (Sum a) | + a & zero a
...@@ -58,9 +58,9 @@ instance Monoid (Product a) | * a & one a ...@@ -58,9 +58,9 @@ instance Monoid (Product a) | * a & one a
instance Monoid (First a) instance Monoid (First a)
instance Monoid (Last a) instance Monoid (Last a)
getDual :: !(Dual a) -> a getDual :: !(Dual .a) -> .a
appEndo :: !(Endo a) -> (a -> a) appEndo :: !(Endo .a) -> (.a -> .a)
getAll :: !All -> Bool getAll :: !All -> Bool
......
...@@ -18,10 +18,10 @@ instance Semigroup (Dual a) | Semigroup a where ...@@ -18,10 +18,10 @@ instance Semigroup (Dual a) | Semigroup a where
instance Monoid (Dual a) | Monoid a where instance Monoid (Dual a) | Monoid a where
mempty = Dual mempty mempty = Dual mempty
instance Semigroup (Endo a) where instance Semigroup (Endo .a) where
mappend (Endo f) (Endo g) = Endo (f o g) mappend (Endo f) (Endo g) = Endo (f o g)
instance Monoid (Endo a) where instance Monoid (Endo .a) where
mempty = Endo id mempty = Endo id
instance Semigroup All where instance Semigroup All where
...@@ -62,10 +62,10 @@ instance Semigroup (Last a) where ...@@ -62,10 +62,10 @@ instance Semigroup (Last a) where
instance Monoid (Last a) where instance Monoid (Last a) where
mempty = Last Nothing mempty = Last Nothing
getDual :: !(Dual a) -> a getDual :: !(Dual .a) -> .a
getDual (Dual x) = x getDual (Dual x) = x
appEndo :: !(Endo a) -> (a -> a) appEndo :: !(Endo .a) -> (.a -> .a)
appEndo (Endo f) = f appEndo (Endo f) = f
getAll :: !All -> Bool getAll :: !All -> Bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment