- data Thrist where
- newtype Flipped m a b = Flipped {
- unflip :: m b a
- mapThrist :: (forall i j. (i +> j) -> i ~> j) -> Thrist +> a b -> Thrist ~> a b
- foldrThrist :: (forall i j. (i ~> j) -> (j +> c) -> i +> c) -> (b +> c) -> Thrist ~> a b -> a +> c
- foldlThrist :: (forall j k. (a +> j) -> (j ~> k) -> a +> k) -> (a +> b) -> Thrist ~> b c -> a +> c
- foldr1Thrist :: (forall i j k. (i ~> j) -> (j ~> k) -> i ~> k) -> Thrist ~> a b -> a ~> b
- foldl1Thrist :: (forall i j k. (i ~> j) -> (j ~> k) -> i ~> k) -> Thrist ~> a b -> a ~> b
- mapMThrist :: Monad m => (forall i j. (i +> j) -> m (i ~> j)) -> Thrist +> a b -> m (Thrist ~> a b)
- foldMThrist :: Monad m => (forall j k. (a +> j) -> (j ~> k) -> m (a +> k)) -> (a +> b) -> Thrist ~> b c -> m (a +> c)
- appendThrist :: Thrist ~> a b -> Thrist ~> b c -> Thrist ~> a c
- nullThrist :: Thrist ~> a b -> Bool
Types:
A type-threaded list of binary polymorphic types.
A newtype wrapper, defined for convenience, that swaps the two type
variables of a binary type. Can be used to reverse a Thrist using
foldlThrist
. See examples.
Fold and map functions:
mapThrist :: (forall i j. (i +> j) -> i ~> j) -> Thrist +> a b -> Thrist ~> a bSource
Equivalent to map
for thrists. Takes a function from one binary type to
another and applies it to each thrist element. For example this could
convert a thrist of (a,b) into a thrist of Either a b:
foldrThrist :: (forall i j. (i ~> j) -> (j +> c) -> i +> c) -> (b +> c) -> Thrist ~> a b -> a +> cSource
Equivalent to foldr
for thrists. Takes a combining function, a value to
replace Nil, and a thrist, returning some new binary type.
foldlThrist :: (forall j k. (a +> j) -> (j ~> k) -> a +> k) -> (a +> b) -> Thrist ~> b c -> a +> cSource
foldr1Thrist :: (forall i j k. (i ~> j) -> (j ~> k) -> i ~> k) -> Thrist ~> a b -> a ~> bSource
foldl1Thrist :: (forall i j k. (i ~> j) -> (j ~> k) -> i ~> k) -> Thrist ~> a b -> a ~> bSource
Monadic functions:
mapMThrist :: Monad m => (forall i j. (i +> j) -> m (i ~> j)) -> Thrist +> a b -> m (Thrist ~> a b)Source
foldMThrist :: Monad m => (forall j k. (a +> j) -> (j ~> k) -> m (a +> k)) -> (a +> b) -> Thrist ~> b c -> m (a +> c)Source
Other list-like functions:
appendThrist :: Thrist ~> a b -> Thrist ~> b c -> Thrist ~> a cSource
Equivalent to (++) for thrists.