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
* Right-associative fold of a structure.
* `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
* the operator.
*/
foldr` :: (a b -> b) !b !(t a) -> b
foldr` :: (a .b -> .b) !.b !(t a) -> .b
/**
* Left-associative fold of a structure.
* `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
* 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
......
......@@ -41,7 +41,7 @@ instance Monoid ()
:: Last a = Last (Maybe a)
instance Semigroup (Dual a) | Semigroup a
instance Semigroup (Endo a)
instance Semigroup (Endo .a)
instance Semigroup All
instance Semigroup Any
instance Semigroup (Sum a) | + a & zero a
......@@ -50,7 +50,7 @@ instance Semigroup (First a)
instance Semigroup (Last a)
instance Monoid (Dual a) | Monoid a
instance Monoid (Endo a)
instance Monoid (Endo .a)
instance Monoid All
instance Monoid Any
instance Monoid (Sum a) | + a & zero a
......@@ -58,9 +58,9 @@ instance Monoid (Product a) | * a & one a
instance Monoid (First 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
......
......@@ -18,10 +18,10 @@ instance Semigroup (Dual a) | Semigroup a where
instance Monoid (Dual a) | Monoid a where
mempty = Dual mempty
instance Semigroup (Endo a) where
instance Semigroup (Endo .a) where
mappend (Endo f) (Endo g) = Endo (f o g)
instance Monoid (Endo a) where
instance Monoid (Endo .a) where
mempty = Endo id
instance Semigroup All where
......@@ -62,10 +62,10 @@ instance Semigroup (Last a) where
instance Monoid (Last a) where
mempty = Last Nothing
getDual :: !(Dual a) -> a
getDual :: !(Dual .a) -> .a
getDual (Dual x) = x
appEndo :: !(Endo a) -> (a -> a)
appEndo :: !(Endo .a) -> (.a -> .a)
appEndo (Endo f) = f
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