Module

Data.Scannable

Package
purescript-scannable
Repository
Risto-Stevcev/purescript-scannable

#Scannable Source

class Scannable f  where

The Scannable class provides scanl and scanr functions for structures that are not Traversable.

Instances should also satisfy the following laws

If it is also a Foldable then it should preserve length:

  • length (scanl f init fa) == length fa
  • length (scanr (flip f) init fa) == length fa

If it is also a Functor then it behaves like map if the accumulated argument is ignored:

  • scanl (\_ → f) _ fa == map f fa
  • scanr (\a _ → f a) _ fa == map f fa

Members

  • scanl :: forall b a. (b -> a -> b) -> b -> f a -> f b
  • scanr :: forall b a. (a -> b -> b) -> b -> f a -> f b

Instances

#scannablePreservesLength Source

scannablePreservesLength :: forall b a f. Foldable f => Scannable f => (b -> a -> b) -> b -> f a -> Boolean

#scannableMapping Source

scannableMapping :: forall b a f. Eq (f b) => Functor f => Scannable f => (a -> b) -> b -> f a -> Boolean

#verifyScannable Source

verifyScannable :: forall b a f. Eq (f b) => Functor f => Foldable f => Scannable f => (b -> a -> b) -> (a -> b) -> b -> f a -> Boolean

#defaultScanl Source

defaultScanl :: forall f b a. ((a -> b -> b) -> b -> f a -> f b) -> (b -> a -> b) -> b -> f a -> f b

#defaultScanr Source

defaultScanr :: forall f b a. ((b -> a -> b) -> b -> f a -> f b) -> (a -> b -> b) -> b -> f a -> f b