base-orphans
Backwards-compatible orphan instances for base
https://github.com/haskell-compat/base-orphans#readme
| Version on this page: | 0.6 |
| LTS Haskell 24.18: | 0.9.3 |
| Stackage Nightly 2025-11-04: | 0.9.3 |
| Latest on Hackage: | 0.9.3 |
base-orphans-0.6@sha256:a3ccebeff965bc4b6323fb3c1d73e40f1df873dc6521b7c88a4d8f0f36ed56dd,2566Module documentation for 0.6
- 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, andMonadZipinstances forProxyAlternative,Applicative,Bounded,Data,Enum,Foldable,Functor,Ix,Monad,MonadFix,MonadPlus,MonadZip, andTraversableinstances for data types inGHC.GenericsApplicativeandAlternativeinstances forReadPandReadPrecApplicativeinstance for strict and lazySTApplicative,Foldable,Functor,Monad, andTraversableinstances forComplex,Dual,First,Last,Product, andSumBitsinstance forBoolBits,Bounded, andIntegralinstances forCDevBits,Bounded,Enum,FiniteBits,Floating,Fractional,Integral,IsString,Ix,Num,Real,RealFloat,RealFrac, andStorableinstances forConstandIdentityDatainstances forAll,Any, andConstData,MonadFixandMonadZipinstances forAlt,Dual,First,Last,Product, andSumDataandIsListinstances forVersionEqandOrdinstances forControl.Exception.ErrorCallEq,Ord,Read, andShowinstances for data types inGHC.GenericsEq,Ord,Read,Show,Foldable, andTraversableinstances forZipListEq1,Ord1,Read1, andShow1instances forNonEmptyFoldableinstance forEither,(,)andConstFunctorinstance forHandler,ArgOrder,OptDescr, andArgDescrFunctor,Applicative,Alternative, andMonadPlusinstances forArrowMonadMonadinstance for(,)Monadinstance forWrappedMonadMonadZipinstance forMaybeMonoid,Eq,Ord,Read, andShowinstances forConstMonoidinstances forIdentityandIONuminstance forSumandProductReadinstance forFixedReadandShowinstances forDownSemigroupinstances forIO,EventandLifetimeShowinstance forFingerprintStorableinstance for(),Complex, andRatioTraversableinstance forEither,(,)andConstTypeableinstance for most data types, typeclasses, and promoted data constructors (when possible)
What is not covered
base-orphans does not define the following instances:
GenericorGeneric1instances. These can be found in theGenerics.Deriving.Instancesmodule of thegeneric-derivinglibrary.- The
Alternative IOandMonadPlus IOinstances. These can be found in theControl.Monad.Trans.Errormodule of thetransformerslibrary.
Supported versions of GHC/base
ghc-8.2.1/base-4.10.0.0ghc-8.0.2/base-4.9.1.0ghc-8.0.1/base-4.9.0.0ghc-7.10.3/base-4.8.2.0ghc-7.10.2/base-4.8.1.0ghc-7.10.1/base-4.8.0.0ghc-7.8.4/base-4.7.0.2ghc-7.8.3/base-4.7.0.1ghc-7.8.2/base-4.7.0.0ghc-7.8.1/base-4.7.0.0ghc-7.6.3/base-4.6.0.1ghc-7.6.2/base-4.6.0.1ghc-7.6.1/base-4.6.0.0ghc-7.4.2/base-4.5.1.0ghc-7.4.1/base-4.5.0.0ghc-7.2.2/base-4.4.1.0ghc-7.2.1/base-4.4.0.0ghc-7.0.4/base-4.3.1.0ghc-7.0.3/base-4.3.1.0ghc-7.0.2/base-4.3.1.0ghc-7.0.1/base-4.3.0.0
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.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 forConstEq1,Ord1,Read1, andShow1instances forNonEmptySemigroupinstances forIO,Event, andLifetime
- 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 forHandlerFunctor.Applicative,Alternative, andMonadPlusinstances forArrowMonad- Expose
ReadandShowinstances forDownon GHCs before 7.8 Bits,Bounded, andIntegralinstances forCDev
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 inbase
Changes in 0.3.2
Storable (Complex a)instance no longer requires aRealFloat aconstraint if usingbase-4.4or later
Changes in 0.3.1
Functor,Applicative, andMonadinstances forFirstandLast
Changes in 0.3.0
Showinstance forFingerprintData.Orphansis nowTrustworthy- Backported the
GenericandGeneric1instances available inbase-4.7.0.0to GHC 7.2, 7.4, and 7.6, namelyConst,WrappedMonad, andZipListfromControl.ApplicativeWrappedArrowfromControl.CategoryAll,Any,Dual,Endo,First,Last,Product, andSumfromData.MonoidU1,Par1,Rec1,K1,M1,(:+:),(:*:),(:.:),Arity,Associativity, andFixityfromGHC.Generics
Changes in 0.2.0
- Drop GHC 6.12 (and
base-4.2.0.0) compatibility - Fix Windows, GHCJS build
Readinstance forFixedApplicativeinstances for strict and lazySTTypeableinstance forSampleVarApplicativeandAlternativeinstances forReadPandReadPrecTypeableinstance forKProxyTypeableinstances for more data types inGHC.-prefixed modulesGenericinstances forArity,Associativity, andFixityfrom theGHC.Genericsmodule- Corrected the
Genericinstance for(:*:)to work around GHC bug #9830