Module

Data.Unfoldable1.Trivial1.Internal

Package
purescript-trivial-unfold
Repository
UnrelatedString/purescript-trivial-unfold

This module provides the Trivial1 type as an existentially quantified dumb wrapper around unfold1, which can be inspected and manipulated to implement various typeclasses and the utilities in Data.Unfoldable1.Trivia1.

This module also contains the implementations of utilities which rely on directly inspecting Trivial1 values and are re-exported by Data.Unfoldable.Trivial1. Use this module directly only if you intend to directly inspect Trivial1 values yourself.

#Trivial1 Source

newtype Trivial1 a

A type wrapping unfoldr1 calls, existentially quantified over the seed type so that it can be ignored in the type constructor. Its Unfoldable1 instance means that it can directly be constructed by calling unfoldr1.

Instances

#Generator1 Source

type Generator1 a b = b -> a /\ (Maybe b)

Alias for the generator function passed to unfoldr1.

#untrivial1 Source

untrivial1 :: forall a c. (forall b. Generator1 a b -> b -> c) -> Trivial1 a -> c

Convenience function for inspecting Trivial values. Calls the function argument on the contents of the inner Exists.

#trivial1 Source

trivial1 :: forall a. Trivial1 a -> Trivial1 a

Specializes its argument to Trivial1.

#turbofish1 Source

turbofish1 :: forall a b. (Trivial1 a -> b) -> Trivial1 a -> b

Function application specialized to a Trivial1 argument, at the same precedence as ($).

Inspired by the Rust syntax of the same name, often used in the analogous context of collecting from an iterator.

#(::<+>) Source

Operator alias for Data.Unfoldable1.Trivial1.Internal.turbofish1 (right-associative / precedence 0)

#uncons1 Source

uncons1 :: forall a u. Unfoldable u => Trivial1 a -> a /\ (u a)

Returns the first element, and an Unfoldable of the remaining elements.

#runTrivial1 Source

runTrivial1 :: forall a u. Unfoldable1 u => Trivial1 a -> u a

Converts to any other Unfoldable1. Can also be seen as evaluating the inner Unfoldr1Call.

This is only useful in implementing utility functions. In all other cases, simply use the desired type directly.