BSD-3-Clause licensed by C. McCann, Oleg Grenrus
Maintained by Oleg Grenrus
This version can be pinned in stack with:these-1.2@sha256:011e22f6891ca028f87c04ea48796696c92d593313a9c699f7ff4f9ffd7aec6e,2882

Module documentation for 1.2

This package provides a data type These a b which can hold a value of either type or values of each type. This is usually thought of as an "inclusive or" type (contrasting Either a b as "exclusive or") or as an "outer join" type (contrasting (a, b) as "inner join").

data These a b = This a | That b | These a b

Since version 1, this package was split into parts:



  • Depend on bifunctor-classes-compat instead of bifunctors See changelog note in bifunctors-5.6: This is breaking change, but affects only GHC-8.0 and older users. In that case you should check various combinations of newer/older bifunctors, these (and e.g. semialign) packages.
  • Depend on assoc-1.1. Since version 1.1 assoc has an almost trivial dependency footprint, so these depends on it unconditionally.
  • Add Bifoldable1 These instance
  • Add Foldable1 (Data.Functor.These1 f g) instance
  • Change Eq (These1 f g a), Ord, Read, Show, NFData instances similarly to how they are changed for Product and Sum in base-

  • Workaround GCC-4 C-preprocessor bug


  • These doesn’t depend on base-compat anymore
  • Add NFData1/2, Hashable1/2, Eq1/2 … instances


  • Reverse dependency with aeson.
    • The QuickCheck instances are moved into quickcheck-instances
    • The semigroupoids instances are gone for now.


  • add partitionEithersNE :: NonEmpty (Either a b) -> These (NonEmpty a) (NonEmpty b)


This is major package reogranisation. Old these were split into

  • these providing only These type and some combinators
  • these-lens providing lens combinators
  • semialign providing Semialign, Align, Zip, Unalign and Unzip classes
  • semialign-indexed providing SemialignWithIndex (izipWith and ialignWith members).
  • monad-chronicle providing ChronicleT and MonadChronicle

Also noticeable change is unalign :: f (These a b) -> (f a, f b). For the old f (These a b) -> (f (Maybe a), f (Maybe b)) use unzipWith (unalign . Just).

  • Many instances are added.
  • Since annotations are removed for all but these package.


  • Add Semialign Tree, Tagged, (->) e; Align Compose and Proxy instances
  • Allow semigroups-0.19 and hashable-1.3


  • Split align and alignWith into own class: Semialign.
  • ialign has default implementation
  • Add Semialign NonEmpty and Identity instances
  • Add Swap and Assoc instances (type classes from assoc package)
  • Move optics into Data.These.Lens module, and and some combinators Data.These.Combinators. Also some combinators are renamed, so naming is now consistent. As the result Data.These has very minimal exports.
  • Change type of partitionThese (nested pairs to triple)
  • Add partitionHereThere :: [These a b] -> ([a],[b])


  • Tigthen lower bounds
  • Add dependency on lens
  • Add assoc, reassoc, swap and Swapped instance
  • Add since annotations for things added in 0.7.x
  • Add AlignWithKey ZipList instance
  • Add Data.Align.Indexed module.
  • Add Data.Functor.These with These1 data type.
  • Add associativity law
  • Add toList property to enforce “align”-feel.
  • Map and IntMap Align instances implemented using merge combinators (when available)


  • Add Compose and (,) Crosswalk instances
  • Add bitraverseThese
  • GHC-8.6 support


  • QuickCheck-2.10 support: Arbitrary1/2 instances
  • GHC-8.2 support


  • Add salign :: (Align f, Semigroup a) => f a -> f a -> f a


  • Support aeson-1: add FromJSON1, FromJSON2 ToJSON1, and ToJSON2 These instances.


  • Add AlignWithKey in Data.Align.Key (added dependency keys)
  • Add These instances for
    • binary: Binary
    • aeson: FromJSON, ToJSON
    • QuickCheck: Arbitrary, CoArbitrary, Function
    • deepseq: NFData


  • Breaking change: Generalized Monad, Applicative instances of These and Chronicle to require only a Semigroup constraint
  • More efficient Align Seq implementation
  • Add Crosswalk Seq and Vector instances

  • Support quickcheck-instances-0.3.12 (tests)

  • Add support to bifunctors-5.1