Search results
uncons :: forall a. Array a -> Maybe { head :: a, tail :: Array a }Break an array into its first element and remaining elements.
Using uncons provides a way of writing code that would use cons patterns
in Haskell or pre-PureScript 0.7:
f (x : xs) = something
f [] = somethingElse
Becomes:
f arr = case uncons arr of
  Just { head: x, tail: xs } -> something
  Nothing -> somethingElse
uncons :: forall a. NonEmptyArray a -> { head :: a, tail :: Array a }uncons :: forall a. List a -> Maybe { head :: a, tail :: List a }Break a list into its first element, and the remaining elements,
or Nothing if the list is empty.
Running time: O(1)
uncons :: forall a. List a -> Maybe { head :: a, tail :: List a }Break a list into its first element, and the remaining elements,
or Nothing if the list is empty.
Running time: O(1)
uncons :: forall a. NonEmptyList a -> { head :: a, tail :: List a }uncons :: forall a. NonEmptyList a -> { head :: a, tail :: List a }uncons :: forall f a. Monad f => ListT f a -> f (Maybe (Tuple a (ListT f a)))Perform the first step of a computation in the ListT monad.
uncons :: String -> Maybe { head :: CodePoint, tail :: String }Returns a record with the first code point and the remaining code points
of the string. Returns Nothing if the string is empty. Operates in
constant space and time.
>>> uncons "𝐀𝐀 c 𝐀"
Just { head: CodePoint 0x1D400, tail: "𝐀 c 𝐀" }
>>> uncons ""
Nothing
uncons :: String -> Maybe { head :: Char, tail :: String }Returns the first character and the rest of the string, if the string is not empty.
uncons "" == Nothing
uncons "Hello World" == Just { head: 'H', tail: "ello World" }
uncons :: NonEmptyString -> { head :: CodePoint, tail :: Maybe NonEmptyString }uncons :: NonEmptyString -> { head :: Char, tail :: Maybe NonEmptyString }Returns the first character and the rest of the string.
uncons "a" == { head: 'a', tail: Nothing }
uncons "Hello World" == { head: 'H', tail: Just (NonEmptyString "ello World") }
uncons :: forall h t s. Cons h t s => Proxy s -> { head :: Proxy h, tail :: Proxy t }uncons :: forall a. CatList a -> Maybe (Tuple a (CatList a))Decompose a catenable list into a Tuple of the first element and
the rest of the catenable list.
Running time: O(1)
Note that any single operation may run in O(n).
uncons :: forall a. CatQueue a -> Maybe (Tuple a (CatQueue a))Decompose a queue into a Tuple of the first element and the rest of the queue.
Running time: O(1)
Note that any single operation may run in O(n).
uncons :: forall s1 s2 a. Pred s1 s2 => Vec s1 a -> { head :: a, tail :: Vec s2 a }Get the head and the tail of a non-empty vector.
uncons :: ByteString -> Maybe { head :: Octet, tail :: ByteString }Θ(n) Unprepend a byte.
uncons :: TokenList -> UnconsTokenuncons :: forall a. OSet a -> Maybe { head :: a, tail :: OSet a }uncons :: forall a. Seq a -> Maybe (Tuple a (Seq a))O(1). If the sequence is nonempty, take one element off its left side and return that together with the rest of the original sequence. Otherwise, return Nothing.
uncons :: forall a. Seq a -> Tuple a (Seq a)O(1). Take one element off the left side of a Seq and return it, together with the (possibly empty) remainder of the Seq.
uncons :: Bits -> { head :: Bit, tail :: Bits }uncons :: forall t6. List t6 -> (List t6) /\ (Maybe t6)uncons :: forall a. ArrayView a -> Maybe { head :: a, tail :: ArrayView a }O(1)
uncons :: forall a. NonEmptyArrayView a -> { head :: a, tail :: ArrayView a }uncons :: forall a. List a -> { head :: a, tail :: List a }uncons :: forall a. List a -> Maybe { head :: a, tail :: List a }Break a list into its first element and remaining elements.
Running time: O(1)
uncons :: forall a rest r f l. IsSymbol l => Cons l (Proxy2 f) rest r => SProxy l -> Smash r a -> Exists (Uncons f rest a)The result of extracting a single interpreter from a Smash product.
Uncons :: forall f x r a. (f x) -> (Smash r (x -> a)) -> Uncons f r a xuncons :: forall a. SortedArray a -> Maybe { head :: a, tail :: SortedArray a }Deconstructs the array to a head and tail, or returns Nothing if the array is empty.
uncons :: forall a u. Unfoldable u => Trivial a -> Maybe (a /\ (u a))Returns the first element and a new Unfoldable generating the remaining elements,
or Nothing if there are no elements.
uncons :: forall t a. Unconsable t => t a -> Maybe { head :: a, tail :: t a }uncons :: forall b. Ord b => List b -> Maybe { head :: b, tail :: List b }uncons' :: forall r. r -> (SourceToken -> TokenList -> r) -> TokenList -> runcons1 :: forall a u. Unfoldable u => Trivial1 a -> a /\ (u a)Returns the first element, and an Unfoldable of the remaining elements.
uncons1 :: forall s t e. Unconsable1 s t => s e -> { head :: e, tail :: t e }unconsH :: forall a w' w h. Pred w w' => Pos h => Pos w => Matrix h w a -> { head :: Vec h a, tail :: Matrix h w' a }> unconsH $ matrix22 1 2 3 4
{ head: [1,3], tail: 
  [2]
  [4] }
unconsV :: forall a h' w h. Pred h h' => Pos h => Pos w => Matrix h w a -> { head :: Vec w a, tail :: Matrix h' w a }> unconsV $ matrix22 1 2 3 4
{ head: [1,2], tail: 
  [3,4] }
UnconsDone :: UnconsTokenUnconsMore :: SourceToken -> TokenList -> UnconsTokenType class for data structures which can be unconsed + some utilities built on top of it
The only requirement for instances of this class is that
checkUnconsableLaws must return true for all possible values.
checkUnconsableLaws t =
  unconsableLength t == length t :: Int
unconsPath :: Request -> Tuple (Maybe String) RequestGets the next segment from the request path if available and returns it along with a scoped request. Useful when routing the request.
The user should interpret Unconsable1 s t constraint as
"s is a non-empty container which can be converted to a possibly empty
container t".
unconsableLength :: forall num a t. Unconsable t => Semiring num => t a -> numEquivalent to length, maybe except of stack safety.
You may want to use this function instead of length if foldr for
the particular data type you are using is not stack-safe.
No further results.