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 a b. (b -> a -> b) -> b -> f a -> f b
  • scanr :: forall a b. (a -> b -> b) -> b -> f a -> f b

Instances

#scannablePreservesLength Source

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

#scannableMapping Source

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

#verifyScannable Source

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

#defaultScanl Source

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

#defaultScanr Source

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