base-orphans
Backwards-compatible orphan instances for base
https://github.com/haskell-compat/base-orphans#readme
| LTS Haskell 24.17: | 0.9.3 | 
| Stackage Nightly 2025-10-31: | 0.9.3 | 
| Latest on Hackage: | 0.9.3 | 
base-orphans-0.9.3@sha256:c95cd3490ef99998a496de26afe8879a1d7780fa181a4479a956c690d74f75f1,3161Module documentation for 0.9.3
- Data
base-orphans
Scope
base-orphans defines orphan instances that mimic instances available in later
versions of base to a wider (older) range of compilers. base-orphans does
not export anything except the orphan instances themselves and complements
base-compat.
Note that base-orphans doesn’t cover every possible instance. See the
What is not covered section for exceptions.
Usage
To use base-orphans, simply import Data.Orphans ().
What is covered
- Alternative,- MonadPlus, and- MonadZipinstances for- Proxy
- Alternative,- Applicative,- Bounded,- Data,- Enum,- Foldable,- Functor,- Ix,- Monad,- MonadFix,- MonadPlus,- MonadZip, and- Traversableinstances for data types in- GHC.Generics
- Alternative,- Eq,- Ord,- Read,- Show,- Foldable, and- Traversableinstances for- ZipList
- Applicativeinstance for- K1from- GHC.Generics
- Applicative,- Bits,- Bounded,- Data,- Enum,- Eq1,- FiniteBits,- Floating,- Foldable,- Fractional,- Functor,- Ix,- Ord1,- Monad,- MonadFix,- MonadZip,- Monoid,- Num,- Read,- Read1,- Real,- RealFloat,- RealFrac,- Semigroup,- Show,- Show1,- Storable, and- Traversableinstances for- Down
- Applicativeand- Alternativeinstances for- ReadPand- ReadPrec
- Applicativeinstance for strict and lazy- ST
- Applicative,- Foldable,- Functor,- Monad, and- Traversableinstances for- Complex,- Dual,- First,- Last,- Product, and- Sum
- Bitsinstance for- Bool
- Bits,- Bounded, and- Integralinstances for- CDev
- Bits,- Bounded,- Enum,- FiniteBits,- Floating,- Fractional,- Integral,- IsString,- Ix,- Num,- Real,- RealFloat,- RealFrac, and- Storableinstances for- Constand- Identity
- Datainstances for- All,- Any, and- Const,- IntPtr,- WordPtr,- WrappedArrowand- WrappedMonad
- Data,- MonadFixand- MonadZipinstances for- Alt,- Dual,- First,- Last,- Product, and- Sum
- Dataand- IsListinstances for- Versionand- ZipList
- Eq{1,2},- Ord{1,2},- Show{1,2}, and- Read{1,2}instances for- (,,)and- (,,,)
- Eqand- Ordinstances for- Control.Exception.ErrorCall
- Eq,- Ord,- Read, and- Showinstances for data types in- GHC.Generics
- Eq,- Ord,- Bounded,- Enum, and- Ixinstances for- Solo
- Eqand- Ordinstances for- Generically1
- Eqand- Ordinstances for- SChar,- SNat, and- SSymbol
- Eq1,- Read1, and- Show1instances for- Complex
- Eq1,- Ord1,- Read1, and- Show1instances for- NonEmpty
- Eq1,- Ord1,- Read1, and- Show1instances for basic- GHC.Genericsrepresentation types
- Enum,- Bounded,- Num,- Real,- Integral,- Fractional,- RealFrac,- Floating, and- RealFloatinstances for- Compose
- Foldableinstance for- Either,- (,)and- Const
- Foldableand- Traversableinstances for- Altfrom- Data.Monoid
- Functor,- Applicative, and- Monadinstances for- (,,) a band- (,,,) a b c
- Functorinstances for- (,,,,) a b c d,- (,,,,,) a b c d e, and- (,,,,,) a b c d e f
- Functorinstance for- Handler,- ArgOrder,- OptDescr, and- ArgDescr
- Functor,- Applicative,- Alternative, and- MonadPlusinstances for- ArrowMonad
- Functor,- Applicative,- Monad,- Alternative, and- MonadPlusinstances for- Kleisli
- Ixinstances for tuples of size 6 through 15
- Ixinstances for integral types in- Foreign.C.Types,- Foreign.Ptr, and- System.Posix.Types
- Monadinstance for- (,)
- Monadinstance for- WrappedMonad
- MonadFail,- Monoid, and- Semigroupinstances for strict- ST
- MonadFixinstance for- (,) a
- MonadFixand- MonadZipinstances for- Complex
- MonadZipinstance for- Maybe
- Monoid,- Eq,- Ord,- Read, and- Showinstances for- Const
- Monoidinstances for- Identityand- IO
- Numinstance for- Sumand- Product
- Readinstance for- Fixed
- Semigroupinstances for- IO,- Eventand- Lifetime
- Semigroupinstances for- V1,- U1,- Par1,- Rec1,- K1,- M1,- (:*:), and- (:.:)from- GHC.Generics.- Monoidinstances for the same types (except- V1).
- Semigroupand- Monoidinstances for- Data.Functor.Productand- Data.Functor.Compose
- Showinstance for- Fingerprint
- Showinstance for- UAddr
- Storableinstance for- (),- Complex, and- Ratio
- TestEqualityinstance for- Compose
- Traversableinstance for- Either,- (,)and- Const
- Ordinstance for- TyConand- TypeRep.
- Typeableinstance for most data types, typeclasses, and promoted data constructors (when possible)
What is not covered
base-orphans does not define the following instances:
- Genericor- Generic1instances. These can be found in the- Generics.Deriving.Instancesmodule of the- generic-derivinglibrary.
- The Alternative IOandMonadPlus IOinstances. These can be found in theControl.Monad.Trans.Errormodule of thetransformerslibrary.
Supported versions of GHC/base
- ghc-9.12.*/- base-4.21.*
- ghc-9.10.*/- base-4.20.*
- ghc-9.8.*/- base-4.19.*
- ghc-9.6.*/- base-4.18.*
- ghc-9.4.*/- base-4.17.*
- ghc-9.2.*/- base-4.16.*
- ghc-9.0.*/- base-4.15.*
- ghc-8.10.*/- base-4.14.*
- ghc-8.8.*/- base-4.13.*
- ghc-8.6.*/- base-4.12.*
- ghc-8.4.*/- base-4.11.*
- ghc-8.2.*/- base-4.10.*
- ghc-8.0.*/- base-4.9.*
We also make an attempt to keep base-orphans building with GHC HEAD, but due
to its volatility, it may not work at any given point in time. If it doesn’t,
please report it!
Patches are welcome; add tests for new code!
Changes
Changes in 0.9.3 [2024.12.06]
- Backport new instances from GHC 9.12/base-4.21:- MonadFixinstance for- (,) a
- Eq1,- Ord1,- Read1, and- Show1instances for basic- GHC.Genericsrepresentation types
- Showinstance for- UAddr
 
- Drop support for pre-8.0 versions of GHC.
Changes in 0.9.2 [2024.04.30]
- Backport new instances from GHC 9.10/base-4.20:- Fractional,- RealFrac,- Floating, and- RealFloatinstances for- Compose
 
Changes in 0.9.1 [2023.10.11]
- Backport new instances from GHC 9.8/base-4.19:- Eqand- Ordinstances for- SChar,- SNat, and- SSymbol
- Enum,- Bounded,- Num,- Real, and- Integralinstances for- Compose
 
Changes in 0.9.0 [2023.03.05]
- Adapt to recent changes to Downinstances:- The Boundedinstance forDownwas changed inbase-4.15.0.0to swap the values ofminBoundandmaxBoundfor the underlying type. This change has now been propagated tobase-orphans.
- The Enuminstance forDownwas removed inbase-4.15.0.0, but a different version of the instance was added back inbase-4.18.0.0, wheresuccandpredare swapped. We have changed the backported version of this instance inbase-orphansto match the behavior of the instance added inbase-4.18.0.0.
- The Integralinstance forDownwas removed frombaseentirely inbase-4.15.0.0. We have finally removed it frombase-orphansin this release, as it actively makes it more difficult to define the aforementionedEnuminstance.
 
- The 
Changes in 0.8.8.1 [2023.03.05]
- Fix GHC 9.4 build error that was accidentally introduced in
base-orphans-0.8.8.
Changes in 0.8.8 [2023.03.05]
- Backport new instances from GHC 9.6.1/base-4.18.0.0:- Functorinstances for the- (,,,,) a b c d,- (,,,,,) a b c d e, and- (,,,,,) a b c d e ftuple types.
- Eqand- Ordinstances for- Generically1
 
Changes in 0.8.7 [2022.08.11]
- Backport new instances from GHC 9.2.2/base-4.16.1.0:- Ixinstances for various integral types in- Foreign.C.Types,- Foreign.Ptr, and- System.Posix.Types. For a complete list of such types, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7385.
 
- Backport a bugfix for the Ord1 Downinstance from GHC 9.4/base-4.17such that it now uses reverse sort order.
Changes in 0.8.6 [2021.10.29]
- Backport Eq,Ord,Bounded,Enum, andIxinstances forSolo, introduced in GHC 9.2/base-4.16
- Remove the backported Eq1andOrd1instances forFixedthat were introduced inbase-orphans-0.8.5. While these briefly appeared in a release candidate version of GHC 9.2.1, they were ultimately removed from the final 9.2.1 release. This release ofbase-orphanssynchronizes with that change.
Changes in 0.8.5 [2021.08.29]
- Backport new instances from GHC 9.2/base-4.16- Eq1,- Read1, and- Show1instances for- Complex
- Eq1and- Ord1instances for- Fixed
- Eq{1,2},- Ord{1,2},- Show{1,2}, and- Read{1,2}instances for- (,,)and- (,,,)
- Semigroupand- Monoidinstances for- Data.Functor.Productand- Data.Functor.Compose
 
Changes in 0.8.4 [2020.12.09]
- Backport the Ordinstances forTyConandTypeRepto be available on GHC 7.0.
Changes in 0.8.3 [2020.09.30]
- Backport new instances from GHC 9.0/base-4.15- MonadFixand- MonadZipinstances for- Complex
- Ixinstances for tuples of size 6 through 15
 
Changes in 0.8.2 [2020.01.27]
- Backport new instances from GHC 8.10/base-4.14- Bits,- Bounded,- Enum,- FiniteBits,- Floating,- Fractional,- Integral,- Ix,- Real,- RealFrac,- RealFloatand- Storableinstances for- Data.Ord.Down
- Functor,- Applicative,- Monad,- Alternative, and- MonadPlusinstances for- Kleisli
- Functor,- Applicative, and- Monadinstances for- (,,) a band- (,,,) a b c
- Datainstances for- WrappedArrowand- WrappedMonad
- Dataand- IsListinstances for- ZipList
- TestEqualityinstance for- Compose
 
- Backport the Typeable (() :: Constraint)instance to be available on GHC 7.8.
Changes in 0.8.1 [2019.03.25]
- Ensure that the test suite passes non-negative numbers to Bitsmethods that require them, such asbit,setBit,clearBit,complementBit, andtestBit.
Changes in 0.8 [2018.07.02]
- Backported new instance from GHC 8.6/base-4.12- Data types in GHC.Generics:- Applicativeinstance for- K1
- Semigroupinstances for- U1,- Par1,- Rec1,- K1,- M1,- (:*:),- (:.:), and- V1
- Monoidinstances for- U1,- Par1,- Rec1,- K1,- M1,- (:*:), and- (:.:)
 
- Foldableand- Traversableinstances for- Data.Monoid.Alt
- MonadFix,- MonadZip,- Data,- Foldable,- Traversable,- Eq1,- Ord1,- Read1, and- Show1instances for- Data.Ord.Down
 
- Data types in 
Changes in 0.7 [2018.03.08]
- Backported new instances from GHC 8.4/base-4.11- Alternativeinstance for- ZipList
- Datainstance for- IntPtrand- WordPtr
- Num,- Functor,- Applicative,- Monad,- Semigroup, and- Monoidinstances for- Data.Ord.Down
- MonadFail,- Semigroup, and- Monoidinstances for strict- ST
 
Changes in 0.6 [2017.04.10]
- Backported new instances from GHC 8.2/base-4.10(see https://github.com/haskell-compat/base-orphans/issues/39):- Datainstance for- Const
- Eq1,- Ord1,- Read1, and- Show1instances for- NonEmpty
- Semigroupinstances for- IO,- Event, and- Lifetime
 
- Backported Typeableinstances for(:+:),(:*:),(:.:),M1,Rec1,ArrowMonad,Kleisli,WrappedArrow,WrappedMonad, andAnyon GHC 7.6 and earlier
- Backported Datainstances for(:+:),(:*:),(:.:),M1, andRec1on GHC 7.6 and earlier
Changes in 0.5.4
- Backported Bits,FiniteBits,Floating,Fractional,Integral,IsString,Num,Real,RealFloat, andRealFracinstances forIdentityandConst(introduced inbase-4.9)
Changes in 0.5.3
- Backported Alternative,MonadPlusandMonadZipinstances forU1andProxy, and made theFunctor,Foldable,Traversable,Alternative, andMonadinstances forU1lazier to correspond withbase-4.9
Changes in 0.5.2
- Backported Enum,Bounded,Ix,Functor,Applicative,Monad,MonadFix,MonadPlus,MonadZip,Foldable,Traversable, andDatainstances for datatypes in theGHC.Genericsmodule (introduced inbase-4.9)
Changes in 0.5.1
- The Storableinstances forComplexandRatioare now exactly as lazy as their counterparts inbase(see issue #36)
Changes in 0.5.0
- GHC 8.0 compatibility
- Backported instances introduced in GHC 8.0/base-4.9(see https://github.com/haskell-compat/base-orphans/issues/32)
Changes in 0.4.5
- Import Control.Monad.Instances(which exportsFunctorandMonadinstances for(->) r, andFunctorinstances for(,) aandEither a) on GHCs before 7.6. This ensures that these instances will always be in scope, and you won’t have to import a module which is deprecated on recent GHC releases.
- Fix build on GHC HEAD (again)
Changes in 0.4.4
- Fix build on GHC HEAD
Changes in 0.4.3
- Fix build on OSes where HTYPE_DEV_T = Int32(e.g., OS X)
Changes in 0.4.2
- Functorinstances for- Handler
- Functor.- Applicative,- Alternative, and- MonadPlusinstances for- ArrowMonad
- Expose ReadandShowinstances forDownon GHCs before 7.8
- Bits,- Bounded, and- Integralinstances for- CDev
Changes in 0.4.1
- Fixed imports on GHC < 7.8 on Windows
Changes in 0.4.0
- Removed all GenericandGeneric1instances. These have been moved to thegeneric-derivinglibrary.
Changes in 0.3.3
- Typeableinstances for- (~),- Any,- Constraint,- CSigset,- Handler,- Opaque,- SPEC, and every promotable data constructor in- base
Changes in 0.3.2
- Storable (Complex a)instance no longer requires a- RealFloat aconstraint if using- base-4.4or later
Changes in 0.3.1
- Functor,- Applicative, and- Monadinstances for- Firstand- Last
Changes in 0.3.0
- Showinstance for- Fingerprint
- Data.Orphansis now- Trustworthy
- Backported the GenericandGeneric1instances available inbase-4.7.0.0to GHC 7.2, 7.4, and 7.6, namely- Const,- WrappedMonad, and- ZipListfrom- Control.Applicative
- WrappedArrowfrom- Control.Category
- All,- Any,- Dual,- Endo,- First,- Last,- Product, and- Sumfrom- Data.Monoid
- U1,- Par1,- Rec1,- K1,- M1,- (:+:),- (:*:),- (:.:),- Arity,- Associativity, and- Fixityfrom- GHC.Generics
 
Changes in 0.2.0
- Drop GHC 6.12 (and base-4.2.0.0) compatibility
- Fix Windows, GHCJS build
- Readinstance for- Fixed
- Applicativeinstances for strict and lazy- ST
- Typeableinstance for- SampleVar
- Applicativeand- Alternativeinstances for- ReadPand- ReadPrec
- Typeableinstance for- KProxy
- Typeableinstances for more data types in- GHC.-prefixed modules
- Genericinstances for- Arity,- Associativity, and- Fixityfrom the- GHC.Genericsmodule
- Corrected the Genericinstance for(:*:)to work around GHC bug #9830
