Hoogle Search
Within LTS Haskell 24.67 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
asSDeque :: SDeque s a -> SDeque s amutable-containers Data.Mutable Since 0.2.0
asUDeque :: UDeque s a -> UDeque s amutable-containers Data.Mutable Since 0.2.0
-
nonempty-containers Data.Sequence.NonEmpty A general-purpose non-empty (by construction) finite sequence type. Non-emptiness means that:
- Functions that take an NESeq can safely operate on it with the assumption that it has at least value.
- Functions that return an NESeq provide an assurance that the result has at least one value.
- The nonEmptySeq smart constructor will convert a Seq a into a Maybe (NESeq a), returning Nothing if the original Seq was empty.
- You can use :<||, :||>, and insertSeqAt to insert a value into a Seq to create a guaranteed NESeq.
- You can use the IsNonEmpty and IsEmpty patterns to "pattern match" on a Seq to reveal it as either containing a NESeq or an empty sequence.
- withNonEmpty offers a continuation-based interface for deconstructing a Seq and treating it as if it were an NESeq.
insertSeqAt :: Int -> a -> Seq a -> NESeq anonempty-containers Data.Sequence.NonEmpty Turn a Seq into a guarantted non-empty NESeq by adding an element at a given index.
insertSeqAt 1 0 (Data.Sequence.fromList [1,2,3]) == fromList (1 :| [0,2,3])
nonEmptySeq :: Seq a -> Maybe (NESeq a)nonempty-containers Data.Sequence.NonEmpty O(1). Smart constructor for an NESeq from a Seq. Returns Nothing if the Seq was originally actually empty, and Just n with an NESeq, if the Seq was not empty. nonEmptySeq and maybe empty toSeq form an isomorphism: they are perfect structure-preserving inverses of eachother. See IsNonEmpty for a pattern synonym that lets you "match on" the possiblity of a Seq being an NESeq.
nonEmptySeq (Data.Sequence.fromList [1,2,3]) == Just (fromList (1) :| [2,3])
-
nonempty-containers Data.Sequence.NonEmpty O(1). Convert a non-empty sequence back into a normal possibly-empty sequence, for usage with functions that expect Seq. Can be thought of as "obscuring" the non-emptiness of the map in its type. See the IsNotEmpty pattern. nonEmptySeq and maybe empty toSeq form an isomorphism: they are perfect structure-preserving inverses of eachother.
unsafeFromSeq :: Seq a -> NESeq anonempty-containers Data.Sequence.NonEmpty O(1). Unsafe version of nonEmptySeq. Coerces a Seq into an NESeq, but is undefined (throws a runtime exception when evaluation is attempted) for an empty Seq.
-
nonempty-containers Data.Sequence.NonEmpty.Internal A general-purpose non-empty (by construction) finite sequence type. Non-emptiness means that:
- Functions that take an NESeq can safely operate on it with the assumption that it has at least value.
- Functions that return an NESeq provide an assurance that the result has at least one value.
- The nonEmptySeq smart constructor will convert a Seq a into a Maybe (NESeq a), returning Nothing if the original Seq was empty.
- You can use :<||, :||>, and insertSeqAt to insert a value into a Seq to create a guaranteed NESeq.
- You can use the IsNonEmpty and IsEmpty patterns to "pattern match" on a Seq to reveal it as either containing a NESeq or an empty sequence.
- withNonEmpty offers a continuation-based interface for deconstructing a Seq and treating it as if it were an NESeq.
NESeq :: a -> !Seq a -> NESeq anonempty-containers Data.Sequence.NonEmpty.Internal No documentation available.
-
nonempty-containers Data.Sequence.NonEmpty.Internal O(1). Convert a non-empty sequence back into a normal possibly-empty sequence, for usage with functions that expect Seq. Can be thought of as "obscuring" the non-emptiness of the map in its type. See the IsNotEmpty pattern. nonEmptySeq and maybe empty toSeq form an isomorphism: they are perfect structure-preserving inverses of eachother.