base-orphans

Backwards-compatible orphan instances for base

https://github.com/haskell-compat/base-orphans#readme

Version on this page:0.5.4
LTS Haskell 22.39:0.9.2
Stackage Nightly 2024-10-31:0.9.2
Latest on Hackage:0.9.2

See all snapshots base-orphans appears in

MIT licensed and maintained by Simon Hengel, João Cristóvão, Ryan Scott
This version can be pinned in stack with:base-orphans-0.5.4@sha256:868edf45e121bf18358403d532d27e6de4ca8c1202deb105e83dad9592bc967c,2568

Module documentation for 0.5.4

base-orphans

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build

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 MonadZip instances for Proxy
  • Alternative, Applicative, Bounded, Data, Enum, Foldable, Functor, Ix, Monad, MonadFix, MonadPlus, MonadZip, and Traversable instances for data types in GHC.Generics
  • Applicative and Alternative instances for ReadP and ReadPrec
  • Applicative instance for strict and lazy ST
  • Applicative, Foldable, Functor, Monad, and Traversable instances for Complex, Dual, First, Last, Product, and Sum
  • Bits instance for Bool
  • Bits, Bounded, and Integral instances for CDev
  • Bits, Bounded, Enum, FiniteBits, Floating, Fractional, Integral, IsString, Ix, Num, Real, RealFloat, RealFrac, and Storable instances for Const and Identity
  • Data instances for All and Any
  • Data, MonadFix and MonadZip instances for Alt, Dual, First, Last, Product, and Sum
  • Data and IsList instances for Version
  • Eq and Ord instances for Control.Exception.ErrorCall
  • Eq, Ord, Read, and Show instances for data types in GHC.Generics
  • Eq, Ord, Read, Show, Foldable, and Traversable instances for ZipList
  • Foldable instance for Either, (,) and Const
  • Functor instance for Handler, ArgOrder, OptDescr, and ArgDescr
  • Functor, Applicative, Alternative, and MonadPlus instances for ArrowMonad
  • Monad instance for (,)
  • Monad instance for WrappedMonad
  • MonadZip instance for Maybe
  • Monoid, Eq, Ord, Read, and Show instances for Const
  • Monoid instances for Identity and IO
  • Num instance for Sum and Product
  • Read instance for Fixed
  • Read and Show instances for Down
  • Show instance for Fingerprint
  • Storable instance for (), Complex, and Ratio
  • Traversable instance for Either, (,) and Const
  • Typeable instance for most data types, typeclasses, and promoted data constructors (when possible)

What is not covered

base-orphans does not define the following instances:

Supported versions of GHC/base

  • ghc-8.0.1 / base-4.9.0.0
  • ghc-7.10.3 / base-4.8.2.0
  • ghc-7.10.2 / base-4.8.1.0
  • ghc-7.10.1 / base-4.8.0.0
  • ghc-7.8.4 / base-4.7.0.2
  • ghc-7.8.3 / base-4.7.0.1
  • ghc-7.8.2 / base-4.7.0.0
  • ghc-7.8.1 / base-4.7.0.0
  • ghc-7.6.3 / base-4.6.0.1
  • ghc-7.6.2 / base-4.6.0.1
  • ghc-7.6.1 / base-4.6.0.0
  • ghc-7.4.2 / base-4.5.1.0
  • ghc-7.4.1 / base-4.5.0.0
  • ghc-7.2.2 / base-4.4.1.0
  • ghc-7.2.1 / base-4.4.0.0
  • ghc-7.0.4 / base-4.3.1.0
  • ghc-7.0.3 / base-4.3.1.0
  • ghc-7.0.2 / base-4.3.1.0
  • ghc-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.5.4

  • Backported Bits, FiniteBits, Floating, Fractional, Integral, IsString, Num, Real, RealFloat, and RealFrac instances for Identity and Const (introduced in base-4.9)

Changes in 0.5.3

  • Backported Alternative, MonadPlus and MonadZip instances for U1 and Proxy, and made the Functor, Foldable, Traversable, Alternative, and Monad instances for U1 lazier to correspond with base-4.9

Changes in 0.5.2

  • Backported Enum, Bounded, Ix, Functor, Applicative, Monad, MonadFix, MonadPlus, MonadZip, Foldable, Traversable, and Data instances for datatypes in the GHC.Generics module (introduced in base-4.9)

Changes in 0.5.1

  • The Storable instances for Complex and Ratio are now exactly as lazy as their counterparts in base (see issue #36)

Changes in 0.5.0

Changes in 0.4.5

  • Import Control.Monad.Instances (which exports Functor and Monad instances for (->) r, and Functor instances for (,) a and Either 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

  • Functor instances for Handler
  • Functor. Applicative, Alternative, and MonadPlus instances for ArrowMonad
  • Expose Read and Show instances for Down on GHCs before 7.8
  • Bits, Bounded, and Integral instances for CDev

Changes in 0.4.1

  • Fixed imports on GHC < 7.8 on Windows

Changes in 0.4.0

  • Removed all Generic and Generic1 instances. These have been moved to the generic-deriving library.

Changes in 0.3.3

  • Typeable instances 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 a constraint if using base-4.4 or later

Changes in 0.3.1

  • Functor, Applicative, and Monad instances for First and Last

Changes in 0.3.0

  • Show instance for Fingerprint
  • Data.Orphans is now Trustworthy
  • Backported the Generic and Generic1 instances available in base-4.7.0.0 to GHC 7.2, 7.4, and 7.6, namely
    • Const, WrappedMonad, and ZipList from Control.Applicative
    • WrappedArrow from Control.Category
    • All, Any, Dual, Endo, First, Last, Product, and Sum from Data.Monoid
    • U1, Par1, Rec1, K1, M1, (:+:), (:*:), (:.:), Arity, Associativity, and Fixity from GHC.Generics

Changes in 0.2.0

  • Drop GHC 6.12 (and base-4.2.0.0) compatibility
  • Fix Windows, GHCJS build
  • Read instance for Fixed
  • Applicative instances for strict and lazy ST
  • Typeable instance for SampleVar
  • Applicative and Alternative instances for ReadP and ReadPrec
  • Typeable instance for KProxy
  • Typeable instances for more data types in GHC.-prefixed modules
  • Generic instances for Arity, Associativity, and Fixity from the GHC.Generics module
  • Corrected the Generic instance for (:*:) to work around GHC bug #9830