ghc-instances-0.1.0.0: ghc-instances.cabal
name: ghc-instances
version: 0.1.0.0
synopsis: Easily import all instances contained in GHC distributed libraries
description:
This package simply has a number of modules which import all the modules
from each package that is distributed with GHC.
There's also a module "Control.Instances.GHC_Packages", that imports all of the
above modules, essentially importing every module distributed with GHC.
Why would you want to do this?
Lets say I've got a data type \"D a\". And a class \"C\".
Further, lets say I can define \"C (D a)\" if "a" is of class \"C1\".
I can also \"C (D a)\" if "a" is of class \"C2\"
Lets try:
instance C1 a => C (D a) where ...
instance C2 a => C (D a) where ...
These are going to be overlapping. We can't do this.
But instead, we import "Control.Instances.GHC_Packages". And then we can use
[reify](https://hackage.haskell.org/package/template-haskell-2.12.0.0/docs/Language-Haskell-TH.html#v:reify)
from [Template Haskell](https://hackage.haskell.org/package/template-haskell-2.12.0.0)
to bring every \"C1\" and \"C2\" instance in to scope that's defined anywhere in "base"
or any GHC module.
We can then use Template Haskell to define all our instances. We can explicitly define what happens
when both \"C1\" and \"C2\" instances are defined, perhaps prefering one over the other.
As we've got the full power of Haskell in Template Haskell, we can do these manipulations.
The package [static-closure](https://hackage.haskell.org/package/static-closure)
is an example of using these instances to generate it's own instances for it's data type.
This package will need to be updated with each release of GHC but currently the
cabal file and modules should contain appropriate pre-processor directives that
this package should work from least from GHC 7.8 to GHC 8.2.
homepage: https://github.com/clintonmead/ghc-instances#readme
license: BSD3
license-file: LICENSE
author: Clinton Mead
maintainer: clintonmead@gmail.com
copyright: Copyright: (c) 2017 Clinton Mead
category: Web
build-type: Simple
cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules:
Control.Instances.GHC_Packages,
Control.Instances.Package.Array,
Control.Instances.Package.Base,
Control.Instances.Package.Binary,
Control.Instances.Package.Bytestring,
Control.Instances.Package.Cabal,
Control.Instances.Package.Containers,
Control.Instances.Package.Deepseq,
Control.Instances.Package.Directory,
Control.Instances.Package.Filepath,
Control.Instances.Package.Ghc,
Control.Instances.Package.Ghc_compact,
Control.Instances.Package.Ghc_boot,
Control.Instances.Package.Ghc_prim,
Control.Instances.Package.Hoopl,
Control.Instances.Package.Hpc,
Control.Instances.Package.Integer_gmp,
Control.Instances.Package.Process,
Control.Instances.Package.Template_haskell,
Control.Instances.Package.Time,
Control.Instances.Package.Unix,
Control.Instances.Package.Win32
build-depends:
array,
base < 4.11,
binary,
bytestring,
Cabal,
containers,
deepseq,
directory,
filepath,
ghc,
ghc-prim,
hoopl,
hpc,
integer-gmp,
process,
template-haskell,
time
if (os(windows))
build-depends:
Win32
else
build-depends:
unix
if (impl(ghc >= 8.2))
build-depends:
ghc-compact
if (impl(ghc >= 8))
build-depends:
ghc-boot
if (impl(ghc < 7.10))
build-depends:
haskell98,
haskell2010,
old-locale,
old-time
ghc-options: -Wall -fno-warn-deprecations
default-language: Haskell2010
source-repository head
type: git
location: https://github.com/clintonmead/ghc-instances