bifunctors
Bifunctors
http://github.com/ekmett/bifunctors/
| LTS Haskell 24.16: | 5.6.2@rev:2 |
| Stackage Nightly 2025-10-24: | 5.6.2@rev:2 |
| Latest on Hackage: | 5.6.2@rev:2 |
bifunctors-5.6.2@sha256:115a621c4eaaabb07834f9e4dd3371e21f39d034305062f4bd5cd72c2f8880d2,3332Module documentation for 5.6.2
- Data
- Data.Biapplicative
- Data.Bifunctor
Changes
5.6.2 [2024.03.19]
- Support building with
template-haskell-2.22.*(GHC 9.10).
5.6.1 [2023.03.13]
- Provide instances for the
SwapandAssoctype classes from theassocpackage. (These instances were previously defined inassocitself, but they have been migrated over tobifunctorsin tandem with theassoc-1.1release.) - Only depend on
bifunctor-classes-compatif building with GHC 8.0.
5.6 [2023.03.12]
-
Drop support for GHC 7.10 and earlier.
-
Move the
Data.Bifunctor,Data.Bifoldable, andData.Bitraversablecompatibility modules to the newbifunctor-classes-compatpackage. For backwards compatibility, thebifunctorslibrary re-exportsData.BifoldableandData.Bitraversablemodules frombifunctor-classes-compatwhen building with GHC 8.0.If your library depends on
bifunctorsand compiles with pre-8.2 versions of GHC, be warned that it may be possible to construct a build plan involving a pre-5.6version ofbifunctorswhere:- Some of the
Bifunctorinstances come frombifunctor-classes-compat’s compatibility classes, and - Other
Bifunctorinstances come frombifunctors’s compatibility classes.
These compatibility classes are distinct, so this could lead to build errors under certain conditions. Some possible ways to mitigate this risk include:
-
Drop support for GHC 8.0 and older in your library.
-
Require
bifunctors >= 5.6in your library. -
If neither of the options above are viable, then you can temporarily define instances for the old compatibility classes from
bifunctorslike so:-- For Bifunctor instances import qualified "bifunctor-classes-compat" Data.Bifunctor as BifunctorCompat #if !MIN_VERSION_bifunctors(5,6,0) && !MIN_VERSION_base(4,8,0) import qualified "bifunctors" Data.Bifunctor as Bifunctor #endif instance BifunctorCompat.Bifunctor MyType where ... #if !MIN_VERSION_bifunctors(5,6,0) && !MIN_VERSION_base(4,8,0) instance Bifunctor.Bifunctor MyType where ... #endif-- For Bifoldable and Bitraversable instances import qualified "bifunctor-classes-compat" Data.Bifoldable as BifoldableCompat import qualified "bifunctor-classes-compat" Data.Bitraversable as BitraversableCompat #if !MIN_VERSION_bifunctors(5,6,0) && !MIN_VERSION_base(4,10,0) import qualified "bifunctors" Data.Bifoldable as Bifoldable import qualified "bifunctors" Data.Bitraversable as Bitraversable #endif instance BifoldableCompat.Bifoldable MyType where ... instance BitraversableCompat.Bitraversable MyType where ... #if !MIN_VERSION_bifunctors(5,6,0) && !MIN_VERSION_base(4,10,0) instance Bifoldable.Bifoldable MyType where ... instance Bitraversable.Bitraversable MyType where ... #endif
If your package does nothing but define instances of
Bifunctoret al., you may consider replacing yourbifunctorsdependency withbifunctor-classes-compatto reduce your dependency footprint. If you do, it is strongly recommended that you bump your package’s major version number so that your users are alerted to the details of the migration. - Some of the
-
Define a
Foldable1instance forJoker, and defineBifoldable1instances forBiff,Clown,Flip,Join,Joker,Product,Tannen, andWrappedBifunctor. These instances were originally defined in thesemigroupoidslibrary, and they have now been migrated tobifunctorsas a side effect of adapting to this Core Libraries Proposal, which addsFoldable1andBifoldable1tobase.
5.5.15 [2023.02.27]
- Support
th-abstraction-0.5.*.
5.5.14 [2022.12.07]
- Define
Functor,Foldable, andTraversableinstances forSumandProduct.
5.5.13 [2022.09.12]
- Make the
Biapplicativeinstances for tuples lazy, to match theirBifunctorinstances.
5.5.12 [2022.05.07]
- Backport an upstream GHC change which removes the default implementation of
bitraverse. Per the discussion in https://github.com/haskell/core-libraries-committee/issues/47, this default implementation was completely broken, as attempting to use it would always result in an infinite loop.
5.5.11 [2021.04.30]
- Allow building with
template-haskell-2.18(GHC 9.2).
5.5.10 [2021.01.21]
- Fix a bug in which
deriveBifoldablecould generate code that triggers-Wunused-matcheswarnings.
5.5.9 [2020.12.30]
- Explicitly mark modules as Safe or Trustworthy.
5.5.8 [2020.10.01]
- Fix a bug in which
deriveBifunctorwould fail on sufficiently complex uses of rank-n types in constructor fields. - Fix a bug in which
deriveBiunctorand related functions would needlessly reject data types whose two last type parameters appear as oversaturated arguments to a type family.
5.5.7 [2020.01.29]
- Add
Data.Bifunctor.Biap.
5.5.6 [2019.11.26]
- Add
Category,Arrow,ArrowChoice,ArrowLoop,ArrowZero, andArrowPlusinstances forData.Bifunctor.Product.
5.5.5 [2019.08.27]
- Add
Eq{1,2},Ord{1,2},Read{1,2}, andShow{1,2}instances for data types in theData.Bifunctor.*module namespace where possible. The operative phrase is “where possible” since many of these instances require the use ofEq2/Ord2/Read2/Show2, which are not available when built againsttransformers-0.4.*.
5.5.4 [2019.04.26]
- Support
th-abstraction-0.3or later. - Don’t incur a
semigroupdependency on recent GHCs.
5.5.3 [2018.07.04]
- Make
biliftA2a class method ofBiapplicative. - Add the
traverseBia,sequenceBia, andtraverseBiaWithfunctions for traversing aTraversablecontainer in aBiapplicative. - Avoid incurring some dependencies when using recent GHCs.
5.5.2 [2018.02.06]
- Don’t enable
Safeon GHC 7.2.
5.5.1 [2018.02.04]
- Test suite fixes for GHC 8.4.
5.5 [2017.12.07]
Data.Bifunctor.THnow derivesbimap/bitraverseimplementations for empty data types that are strict in the argument.Data.Bifunctor.THno longer derivesbifoldr/bifoldMapimplementations that error on empty data types. Instead, they simply return the folded state (forbifoldr) ormempty(forbifoldMap).- When using
Data.Bifunctor.THto deriveBifunctororBitraversableinstances for data types where the last two type variables are at phantom roles, generatedbimap/bitraverseimplementations now usecoercefor efficiency. - Add
OptionstoData.Bifunctor.TH, along with variants of existing functions that takeOptionsas an argument. For now, the only configurable option is whether derived instances for empty data types should use theEmptyCaseextension (this is disabled by default).
5.4.2
- Make
deriveBitraversableuseliftA2in derived implementations ofbitraversewhen possible, now thatliftA2is a class method ofApplicative(as of GHC 8.2) - Backport slightly more efficient implementations of
bimapDefaultandbifoldMapDefault
5.4.1
- Add explicit
Safe,Trustworthy, andUnsafeannotations. In particular, annotate theData.Bifoldablemodule asTrustworthy(previously, it was inferred to beUnsafe).
5.4
- Only export
Data.BifoldableandData.Bitraversablewhen building on GHC < 8.1, otherwise they come frombase - Allow TH derivation of
BifunctorandBifoldableinstances for datatypes containing unboxed tuple types
5.3
- Added
bifoldr1,bifoldl1,bimsum,biasum,binull,bilength,bielem,bimaximum,biminimum,bisum,biproduct,biand,bior,bimaximumBy,biminimumBy,binotElem, andbifindtoData.Bifoldable - Added
Bifunctor,Bifoldable, andBitraversableinstances forGHC.Generics.K1 - TH code no longer generates superfluous
memptyorpuresubexpressions in derivedBifoldableorBitraversableinstances, respectively
5.2.1
- Added
BifoldableandBitraversableinstances forConstantfromtransformers Data.Bifunctor.THnow compiles warning-free on GHC 8.0
5.2
- Added several
Arrow-like instances forTannenso we can use it as the Cayley construction if needed. - Added
Data.Bifunctor.Sum - Added
BifunctorFunctor,BifunctorMonadandBifunctorComonad. - Backported
Bifunctor Constantinstance fromtransformers
5.1
- Added
Data.Bifunctor.Fix - Added
Data.Bifunctor.TH, which permitsTemplateHaskell-based deriving ofBifunctor,BifoldableandBitraversableinstances. - Simplified
Bitraversable.
5
- Inverted the dependency on
semigroupoids. We can support a much wider array ofbaseversions than it can. - Added flags
4.2.1
- Support
Argfromsemigroups0.16.2 - Fixed a typo.
4.2
- Bumped dependency on
tagged, which is required to build cleanly on GHC 7.9+ - Only export
Data.Bifunctorwhen building on GHC < 7.9, otherwise it comes frombase.
4.1.1.1
- Added documentation for ‘Bifoldable’ and ‘Bitraversable’
4.1.1
- Added
Data.Bifunctor.Join - Fixed improper lower bounds on
base
4.1.0.1
- Updated to BSD 2-clause license
4.1
- Added product bifunctors
4.0
- Compatibility with
semigroupoids4.0
3.2
- Added missing product instances for
BiapplicativeandBiapply.
3.1
- Added
Data.Biapplicative. - Added the
ClownandJokerbifunctors from Conor McBride’s “Clowns to the left of me, Jokers to the right.” - Added instances for
Const, higher tuples - Added
Taggedinstances.
3.0.4
- Added
Data.Bifunctor.FlipandData.Bifunctor.Wrapped.
3.0.3
- Removed upper bounds from my other package dependencies