Data.Unfoldable.Trivial.Internal
- Package
- purescript-trivial-unfold
- Repository
- UnrelatedString/purescript-trivial-unfold
This module provides the Trivial type as an existentially quantified
dumb wrapper around unfold, which can be inspected and manipulated
to implement various typeclasses and the utilities in Data.Unfoldable.Trivial.
This module also contains the implementations of utilities which rely on directly
inspecting Trivial values and are re-exported by Data.Unfoldable.Trivial.
Use this module directly only if you intend to directly inspect Trivial values yourself.
#Trivial Source
newtype Trivial aA type wrapping unfoldr calls, existentially quantified over the seed type
so that it can be ignored in the type constructor. Its Unfoldable instance
means that it can directly be constructed by calling unfoldr.
Instances
Unfoldable TrivialUnfoldable1 TrivialFunctor TrivialFoldable TrivialThe raison d'être for
Trivial. Allows folding polymorphicUnfoldables as they generate.foldruses a default implementation and may be inefficient. Note also that this enables the use ofsequence_despite the lack of aTraversableinstance, which is not provided because it would require forcing and accumulating every value, at which point any would-be user is better off with an actual container.(Arbitrary a, Coarbitrary a) => Arbitrary (Trivial a)Guaranteed finite.
Lazy (Trivial a)
#(::<*>) Source
Operator alias for Data.Unfoldable.Trivial.Internal.turbofish (right-associative / precedence 0)
#unfoldr1Default Source
unfoldr1Default :: forall a b t. Unfoldable t => (b -> a /\ (Maybe b)) -> b -> t aProvides a default implementation of unfoldr1 using unfoldr to satisfy
the superclass bound on Unfoldable.
#runTrivial Source
runTrivial :: forall a u. Unfoldable u => Trivial a -> u aConverts to any other Unfoldable.
Can also be seen as evaluating the inner UnfoldrCall.
This is only useful in implementing utility functions. In all other cases, simply use the desired type directly.
Wraps both arguments to
unfoldrin anUnfoldrCall.