Module

Data.FingerTree.Digit

#Digit

newtype Digit a

A Digit is just an array which has between one and four elements (inclusive). If a Digit has two or three elements, it is described as 'safe'; otherwise, it is described as 'dangerous'.

Instances

#mkDigit

mkDigit :: forall a. Partial => Array a -> Digit a

This function is only defined when the argument has between one and four elements inclusive. It will not throw an error if this is not satisfied, although the Digit length invariant will be violated, which will cause other functions to break.

#mkDigitMay

mkDigitMay :: forall a. Array a -> Maybe (Digit a)

Like mkDigit, except this returns Nothing on invalid input.

#mkDigit1

mkDigit1 :: forall a. a -> Digit a

#mkDigit2

mkDigit2 :: forall a. a -> a -> Digit a

#mkDigit3

mkDigit3 :: forall a. a -> a -> a -> Digit a

#runDigit

runDigit :: forall a. Digit a -> Array a

#headDigit

headDigit :: forall a. Digit a -> a

#tailDigit

tailDigit :: forall a. Digit a -> Array a

#initDigit

initDigit :: forall a. Digit a -> Array a

#lastDigit

lastDigit :: forall a. Digit a -> a

#snocDigit

snocDigit :: forall a. Partial => Digit a -> a -> Digit a

Append a single element. This is partial because the result is not defined in the case where the argument has 4 elements.

#consDigit

consDigit :: forall a. Partial => a -> Digit a -> Digit a

Prepend a single element. This is partial because the result is not defined in the case where the argument has 4 elements.

#dropDigit

dropDigit :: forall a. Int -> Digit a -> Array a

#digitLength

digitLength :: forall a. Digit a -> Int

#unsafeIndex

unsafeIndex :: forall a. Partial => Digit a -> Int -> a

#(!)

Operator alias for Data.FingerTree.Digit.unsafeIndex (non-associative / precedence 2)

Modules