Copyright | (c) OleksandrZhabenko 2020 |
---|---|
License | MIT |
Stability | Experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Maintainer : olexandr543@yahoo.com
Some extension to the Foldable
and Monoid
classes. Introduces a new class InsertLeft
-- the class of types of values that can be inserted from the left
to the Foldable
structure that is simultaneously the data that is also the Monoid
instance.
Synopsis
- class (Foldable t, Eq a, Eq (t a)) => InsertLeft t a where
- subG :: (InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a -> t a -> t (t a)
- dropWhile :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a
- takeWhile :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a
- span :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> (t a, t a)
- preAppend :: (InsertLeft t a, Monoid (t (t a))) => t a -> t (t a) -> t (t a) -> t (t a)
Documentation
subG :: (InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a -> t a -> t (t a) Source #
Inspired by: https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.OldList.html#words
and: Graham Hutton. A tutorial on the universality and expressiveness of fold. J. Functional Programming 9 (4): 355–372, July 1999.
that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf. Is similar to the words
but operates on more general
structures an allows more control.
dropWhile :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a Source #
Inspired by: Graham Hutton. A tutorial on the universality and expressiveness of fold. J. Functional Programming 9 (4): 355–372, July 1999. that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf.
takeWhile :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a Source #
Inspired by: Graham Hutton. A tutorial on the universality and expressiveness of fold. J. Functional Programming 9 (4): 355–372, July 1999. that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf.
span :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> (t a, t a) Source #
Inspired by: Graham Hutton. A tutorial on the universality and expressiveness of fold. J. Functional Programming 9 (4): 355–372, July 1999. that is available at the URL: https://www.cs.nott.ac.uk/~pszgmh/fold.pdf.
preAppend :: (InsertLeft t a, Monoid (t (t a))) => t a -> t (t a) -> t (t a) -> t (t a) Source #
Prepends and appends the given two first arguments to the third one.