HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulestrict-0.5.1Haskell2010

Data.Strict.These

  • 1 type
  • 11 values
  • 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

4 declarations
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.

valuemergeThese :: (a -> a -> a) -> These a a -> a
#

Coalesce with the provided operation.

valuemergeTheseWith :: (a -> c) -> (b -> c) -> (c -> c -> c) -> These a b -> c
#

bimap and coalesce results with the provided operation.

Partition

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

Select each constructor and partition them into separate lists.

valuepartitionHereThere :: [These a b] -> ([a], [b])
#

Select here and there elements 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

4 declarations

This distributivity combinators aren't isomorphisms!