pinchot-0.18.0.2: Write grammars, not parsers

Safe HaskellNone
LanguageHaskell2010

Pinchot.NonEmpty

Description

Sequences that always contain at least one element.

Synopsis

Documentation

data NonEmpty a Source

A non-empty sequence.

Constructors

NonEmpty 

Fields

_front :: a

The first item

_rest :: Seq a

All remaining items

rest :: forall a. Lens' (NonEmpty a) (Seq a) Source

front :: forall a. Lens' (NonEmpty a) a Source

flatten :: NonEmpty a -> Seq a Source

Convert a NonEmpty to a Seq.

seqToNonEmpty :: Seq a -> Maybe (NonEmpty a) Source

Converts a non-empty Seq to a NonEmpty; Nothing if the Seq is empty.

prependSeq :: Seq a -> NonEmpty a -> NonEmpty a Source

Prepends a Seq to a NonEmpty.

appendSeq :: NonEmpty a -> Seq a -> NonEmpty a Source

Appends a Seq to a NonEmpty.

append :: NonEmpty a -> NonEmpty a -> NonEmpty a Source

Associative operation that appends to NonEmpty.

singleton :: a -> NonEmpty a Source

Place a single item at the head of the NonEmpty.