on master help sign in
ifcxt/ifcxt.cabal
74 lines 1.9 kB history raw
1-- Initial ifcxt.cabal generated by cabal init. For further documentation,
2-- see http://haskell.org/cabal/users-guide/
4name: ifcxt
5version: 0.1.1
6synopsis: put if statements within type constraints
7description:
9 This package introduces the @ifCxt@ function,
10 which lets your write if statements that depend on a polymorphic variable's class instances.
11 For example, we can make a version of 'show' that can be called on any type:
13 .
15 > cxtShow :: forall a. IfCxt (Show a) => a -> String
16 > cxtShow a = ifCxt (Proxy::Proxy (Show a))
17 > (show a)
18 > "<<unshowable>>"
20 Running this function in ghci, we get:
22 .
24 >>> cxtShow (1 :: Int)
25 "1"
27 .
29 >>> cxtShow (id :: a -> a)
30 "<<unshowable>>"
32 .
34 See the project webpage http://github.com/mikeizbicki/ifcxt for more details.
36homepage: http://github.com/mikeizbicki/ifcxt
37license: BSD3
38license-file: LICENSE
39author: Mike Izbicki
40maintainer: mike@izbicki.me
41-- copyright:
42category: Control
43build-type: Simple
44-- extra-source-files:
45cabal-version: >=1.10
47source-repository head
48 type: git
49 location: http://github.com/mikeizbicki/ifcxt
51library
52 exposed-modules: IfCxt, IfCxt.Examples
53 -- other-modules:
54 default-extensions:
55 ConstraintKinds,
56 CPP,
57 Rank2Types,
58 FlexibleInstances,
59 FlexibleContexts,
60 TemplateHaskell
61 build-depends: base >=4.8, template-haskell >=2.10
62 hs-source-dirs: src
63 default-language: Haskell2010
65test-suite test
66 default-language: Haskell2010
67 type: exitcode-stdio-1.0
68 hs-source-dirs: test
69 main-is: Main.hs
70 build-depends: base >= 4.8
71 , ifcxt
72 , QuickCheck
73 , tasty >= 0.7
74 , tasty-quickcheck