From cc0565112fa3cb380be4435083b823a9e6b031ab Mon Sep 17 00:00:00 2001 From: Stephen Diehl Date: Tue, 13 Dec 2016 09:14:39 +0000 Subject: [PATCH] monoid and fold rearranging --- docs/Folds.md | 9 +++++++++ docs/List.md | 11 +++++++++++ docs/Monoid.md | 6 ++++++ src/Protolude.hs | 1 + 4 files changed, 27 insertions(+) diff --git a/docs/Folds.md b/docs/Folds.md index 0e3147218..80f579121 100644 --- a/docs/Folds.md +++ b/docs/Folds.md @@ -160,3 +160,12 @@ notElem :: (Foldable t, Eq a) => a -> t a -> Bool ```haskell find :: Foldable t => (a -> Bool) -> t a -> Maybe a ``` + + +```haskell +foldr1May :: (a -> a -> a) -> [a] -> Maybe a +``` + +```haskell +foldl1May :: (a -> a -> a) -> [a] -> Maybe a +``` diff --git a/docs/List.md b/docs/List.md index fdc7b6442..ad72c8cf8 100644 --- a/docs/List.md +++ b/docs/List.md @@ -109,3 +109,14 @@ filter :: (a -> Bool) -> [a] -> [a] ```haskell replicate :: Int -> a -> [a] ``` + +Indexing +-------- + +```haskell +atMay :: [a] -> Int -> Maybe a +``` + +```haskell +atDef :: a -> [a] -> Int -> a +``` diff --git a/docs/Monoid.md b/docs/Monoid.md index c9aa00622..55b8a68f2 100644 --- a/docs/Monoid.md +++ b/docs/Monoid.md @@ -29,14 +29,20 @@ mconcat :: Monoid a => [a] -> a Semigroup --------- +#### <> + ```haskell (<>) :: Semigroup a => a -> a -> a ``` +#### sconcat + ```haskell sconcat :: Semigroup a => NonEmpty a -> a ``` +#### stimes + ```haskell stimes :: (Semigroup a, Integral b) => b -> a -> a ``` diff --git a/src/Protolude.hs b/src/Protolude.hs index 1cb87e2ad..73892ba61 100644 --- a/src/Protolude.hs +++ b/src/Protolude.hs @@ -305,6 +305,7 @@ import Data.Function as X ( -- Genericss import GHC.Generics as X ( Generic(..) + , Generic1 , Rep , K1(..) , M1(..)