subG-0.1.1.0: Some extension to the Foldable and Monoid classes.

Copyright(c) OleksandrZhabenko 2020
LicenseMIT
StabilityExperimental
Safe HaskellSafe
LanguageHaskell2010

Data.SubG

Description

Maintainer : olexandr543@yahoo.com

Some extension to the Foldable and Monoid classes. Introduces a new class InsertLeft -- the type of values that can be inserted from the left to the Foldable structure that is simultaneously the Monoid instance.

Synopsis

Documentation

class (Foldable t, Eq a, Eq (t a)) => InsertLeft t a where Source #

Some extension to the Foldable and Monoid classes.

Methods

(%@) :: a -> t a -> t a infixr 1 Source #

(%^) :: t a -> t (t a) -> t (t a) infixr 1 Source #

Instances
Eq a => InsertLeft [] a Source # 
Instance details

Defined in Data.SubG

Methods

(%@) :: a -> [a] -> [a] Source #

(%^) :: [a] -> [[a]] -> [[a]] Source #

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.

dropWhile :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a Source #

takeWhile :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> t a Source #

span :: (InsertLeft t a, Monoid (t a)) => (a -> Bool) -> t a -> (t a, t a) Source #

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.