Module

Containers.Difference

Package
purescript-difference-containers
Repository
8084/purescript-difference-containers

#Difference Source

newtype Difference cnt e

Difference cnt e is a data structure analogous to difference lists, where cnt is a container type, e.g. List from Data.List.Lazy, and e is an element type.

Constructors

Instances

#Diff Source

class (Foldable cnt) <= Diff cnt  where

Diff typeclass generalizes difference lists.

  • dempty is an empty structure used for unfolding Difference cnt e.
  • dappend is an associative operation with time complexity that depends on the first argument's size more than on the size of the second.
  • dsingleton should wrap one element into the container.

Members

Instances

#fromFoldable Source

fromFoldable :: forall f. Diff f => Foldable f => f ~> (Difference f)

#fromFoldable' Source

fromFoldable' :: forall d f. Diff d => Foldable f => f ~> (Difference d)

For any Foldable container, construct any other Diff container.

#toContainer Source

toContainer :: forall cnt. Diff cnt => (Difference cnt) ~> cnt

#fromContainer Source

fromContainer :: forall cnt. Diff cnt => cnt ~> (Difference cnt)

#singleton Source

singleton :: forall a cnt. Diff cnt => a -> Difference cnt a

#cons Source

cons :: forall a cnt. Diff cnt => a -> Difference cnt a -> Difference cnt a

O(1). Prepend a single element.

#snoc Source

snoc :: forall a cnt. Diff cnt => Difference cnt a -> a -> Difference cnt a

O(1). Append a single element.