Module

Data.FingerTree.Digit

Package
purescript-sequences
Repository
hdgarrood/purescript-sequences

#Digit Source

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

#runDigit Source

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

#mkDigit1 Source

mkDigit1 :: forall a. a -> Digit a

#mkDigit2 Source

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

#mkDigit3 Source

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

#mkDigit Source

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 Source

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

Like mkDigit, except this returns Nothing on invalid input.

#headDigit Source

headDigit :: forall a. Digit a -> a

#tailDigit Source

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

#lastDigit Source

lastDigit :: forall a. Digit a -> a

#initDigit Source

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

#dropDigit Source

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

#snocDigit Source

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 Source

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.

#digitLength Source

digitLength :: forall a. Digit a -> Int

#unsafeIndex Source

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

#(!) Source

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