HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

  • Packagestrict-0.5.1
  • Exports12
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceThese.hs
datadata These a b

The strict these type.

Constructors

Instances36Bifoldable, Bifunctor, Bitraversable, Eq2, Ord2, Read2, …

Functions to get rid of These

valuethese :: (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c

Case analysis for the These type.

valuefromThese :: a -> b -> These a b -> (a, b)

Takes two default values and produces a tuple.

Partition

valuepartitionThese :: [These a b] -> ([a], [b], [(a, b)])

Select each constructor and partition them into separate lists.

Like partitionEithers but for NonEmpty types.

Note: this is not online algorithm. In the worst case it will traverse the whole list before deciding the result constructor.

Example1 expression
partitionEithersNE $ Left 'x' :| [Right 'y']These ('x' :| "") ('y' :| "")
Example1 expression
partitionEithersNE $ Left 'x' :| map Left "yz"This ('x' :| "yz")

Distributivity

This distributivity combinators aren't isomorphisms!