Safe Haskell | Safe-Inferred |
---|

- data Thrist where
- newtype Flipped m a b = Flipped {
- unflip :: m b a

- mapThrist :: (forall i j. (i `brr` j) -> i `arr` j) -> Thrist brr a b -> Thrist arr a b
- foldrThrist :: (forall i j. (i `arr` j) -> (j `brr` c) -> i `brr` c) -> (b `brr` c) -> Thrist arr a b -> a `brr` c
- foldlThrist :: (forall j k. (a `brr` j) -> (j `arr` k) -> a `brr` k) -> (a `brr` b) -> Thrist arr b c -> a `brr` c
- foldr1Thrist :: (forall i j k. (i `arr` j) -> (j `arr` k) -> i `arr` k) -> Thrist arr a b -> a `arr` b
- foldl1Thrist :: (forall i j k. (i `arr` j) -> (j `arr` k) -> i `arr` k) -> Thrist arr a b -> a `arr` b
- mapMThrist :: Monad m => (forall i j. (i `brr` j) -> m (i `arr` j)) -> Thrist brr a b -> m (Thrist arr a b)
- foldMThrist :: Monad m => (forall j k. (a `brr` j) -> (j `arr` k) -> m (a `brr` k)) -> (a `brr` b) -> Thrist arr b c -> m (a `brr` c)
- appendThrist :: Thrist arr a b -> Thrist arr b c -> Thrist arr a c
- nullThrist :: Thrist arr a b -> Bool
- lengthThrist :: Thrist arr a b -> Int

# 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 `brr` j) -> i `arr` j) -> Thrist brr a b -> Thrist arr 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 `arr` j) -> (j `brr` c) -> i `brr` c) -> (b `brr` c) -> Thrist arr a b -> a `brr` 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 `brr` j) -> (j `arr` k) -> a `brr` k) -> (a `brr` b) -> Thrist arr b c -> a `brr` cSource

foldr1Thrist :: (forall i j k. (i `arr` j) -> (j `arr` k) -> i `arr` k) -> Thrist arr a b -> a `arr` bSource

foldl1Thrist :: (forall i j k. (i `arr` j) -> (j `arr` k) -> i `arr` k) -> Thrist arr a b -> a `arr` bSource

## Monadic functions:

mapMThrist :: Monad m => (forall i j. (i `brr` j) -> m (i `arr` j)) -> Thrist brr a b -> m (Thrist arr a b)Source

foldMThrist :: Monad m => (forall j k. (a `brr` j) -> (j `arr` k) -> m (a `brr` k)) -> (a `brr` b) -> Thrist arr b c -> m (a `brr` c)Source

# Other list-like functions:

appendThrist :: Thrist arr a b -> Thrist arr b c -> Thrist arr a cSource

Equivalent to (++) for thrists.

lengthThrist :: Thrist arr a b -> IntSource

Returns the length of the Thrist.