Module

Data.List.Safe

Package
purescript-safelist
Repository
garyb/purescript-safelist

#Emptiness Source

data Emptiness :: Type

#Empty Source

#NonEmpty Source

#SafeList Source

data SafeList t a

A list type that tracks the emptiness of the list.

Constructors

#cons Source

cons :: forall a t. a -> SafeList t a -> SafeList NonEmpty a

#(:) Source

Operator alias for Data.List.Safe.cons (right-associative / precedence 6)

#nil Source

nil :: forall a. SafeList Empty a

#head Source

head :: forall a. SafeList NonEmpty a -> a

Get head of known-to-be-non-empty SafeList

#toNEL Source

toNEL :: forall a. SafeList NonEmpty a -> NonEmptyList a

Converts a known-to-be-non-empty SafeList into a NonEmptyList.

#toList Source

toList :: forall t a. SafeList t a -> List a

Converts a SafeList into a normal List.

#toUnfoldable Source

toUnfoldable :: forall f t a. Unfoldable f => SafeList t a -> f a

Converts a SafeList into some unfoldable structure.

#Leibniz Source

newtype Leibniz (a :: Emptiness) (b :: Emptiness)

Leibniz equality, specialised to Emptiness

Constructors

#SafeListX Source

data SafeListX :: Type -> Type

A version of SafeList with the emptiness variable hidden.

#mkSafeListX Source

mkSafeListX :: forall t a. SafeList t a -> SafeListX a

#unSafeListX Source

unSafeListX :: forall a r. (forall t. SafeList t a -> r) -> SafeListX a -> r