Class of data structures with 3 type arguments that can be unfolded.
- class Triunfoldable t where
- triunfold_ :: (Triunfoldable t, Unfolder f) => f (t () () ())
- triunfoldBF :: (Triunfoldable t, Unfolder f) => f a -> f b -> f c -> f (t a b c)
- triunfoldBF_ :: (Triunfoldable t, Unfolder f) => f (t () () ())
- triunfoldr :: Triunfoldable t => (d -> Maybe (a, d)) -> (d -> Maybe (b, d)) -> (d -> Maybe (c, d)) -> d -> Maybe (t a b c)
- fromLists :: Triunfoldable t => [a] -> [b] -> [c] -> Maybe (t a b c)
- randomDefault :: (Random a, Random b, Random c, RandomGen g, Triunfoldable t) => g -> (t a b c, g)
- arbitraryDefault :: (Arbitrary a, Arbitrary b, Arbitrary c, Triunfoldable t) => Gen (t a b c)
Data structures with 3 type arguments (kind
* -> * -> * -> *) that can be unfolded.
For example, given a data type
data Tree a b c = Empty | Leaf a | Node (Tree a b c) b (Tree a b c)
a suitable instance would be
instance Triunfoldable Tree where triunfold fa fb fc = choose [ pure Empty , Leaf <$> fa , Node <$> triunfold fa fb fc <*> fb <*> triunfold fa fb fc ]
i.e. it follows closely the instance for
Biunfoldable, but for 3 type arguments instead of 2.
Given a way to generate elements, return a way to generate structures containing those elements.
Unfold the structure, always using
() as elements.
Breadth-first unfold, which orders the result by the number of
Unfold the structure breadth-first, always using
() as elements.
triunfoldr builds a data structure from a seed value.
Create a data structure using the lists as input. This can fail because there might not be a data structure with the same number of element positions as the number of elements in the lists.
Generate a random value, can be used as default instance for