-- Initial th-dict-discovery.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ name: th-dict-discovery version: 0.1.0.0 synopsis: Automatically discover available dictionaries at compile time. description: th-dict-discovery is a library to get your hands on the in-scope, concrete instances of a class. The motivating use-case is to generate property tests to automatically prove new instances of a class follow the laws. . This library uses Template Haskell to provide a list of existentialized 'Dict's for each concrete (entirely monomorphic) instance in scope. . > defInstances :: [SomeDict1 Default] > defInstances = $(someDicts ''Default) . These lists can be consumed via @withSomeDict1 :: (forall a. c a => Proxy a -> r) -> SomeDict1 c -> r@, for example, we can generate hspec tests: . > spec :: Spec > spec = describe "each default instance" . > forM_ defInstances $ withSomeDict1 $ \(_ :: Proxy a) -> > it "shouldn't be undefined" $ > seq (def @a) True `shouldBe` True . The library also defines up to 'SomeDict8', with eliminators up to 'withSomeDict8'. These correspond to multi-parameter typeclasses with first-order, potentially polykinded parameters. . The TH function 'someDicts' is smart enough to generate the correct arity of 'SomeDictN' for the class under inspection, but at this time, you're responsible for using the correct 'withSomeDictN' to consume it. license: BSD3 license-file: LICENSE author: Sandy Maguire maintainer: sandy@sandymaguire.me homepage: http://github.com/isovector/th-dict-discovery/ bug-reports: http://github.com/isovector/th-dict-discovery/issues -- copyright: category: Language build-type: Simple extra-source-files: ChangeLog.md cabal-version: >=1.10 tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1 source-repository head type: git location: https://github.com/isovector/th-dict-discovery.git library exposed-modules: Language.Haskell.Discovery -- other-modules: -- other-extensions: build-depends: base >=4.9 && <4.10, template-haskell, constraints hs-source-dirs: src default-language: Haskell2010