ghc-instances: Easily import all instances contained in GHC distributed libraries
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 from Template Haskell 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 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.
Modules
[Index]
- Control
- Instances
- Control.Instances.GHC_Packages
- Package
- 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_boot
- Control.Instances.Package.Ghc_compact
- 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
- Instances
Downloads
- ghc-instances-0.1.0.1.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1.0.0, 0.1.0.1 |
---|---|
Dependencies | array, base (<4.11), binary, bytestring, Cabal, containers, deepseq, directory, filepath, ghc, ghc-boot, ghc-compact, ghc-prim, haskell2010, haskell98, hoopl, hpc, integer-gmp, old-locale, old-time, process, template-haskell, time, unix, Win32 [details] |
License | BSD-3-Clause |
Copyright | Copyright: (c) 2017 Clinton Mead |
Author | Clinton Mead |
Maintainer | clintonmead@gmail.com |
Revised | Revision 1 made by clinton at 2018-01-17T14:17:52Z |
Category | Web |
Home page | https://github.com/clintonmead/ghc-instances#readme |
Source repo | head: git clone https://github.com/clintonmead/ghc-instances |
Uploaded | by clinton at 2018-01-17T14:16:28Z |
Distributions | |
Reverse Dependencies | 1 direct, 1 indirect [details] |
Downloads | 1256 total (13 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2018-01-17 [all 1 reports] |