mirror of
https://github.com/mikeizbicki/ifcxt.git
synced 2024-10-03 18:37:19 +03:00
75 lines
1.9 KiB
Plaintext
75 lines
1.9 KiB
Plaintext
-- Initial ifcxt.cabal generated by cabal init. For further documentation,
|
|
-- see http://haskell.org/cabal/users-guide/
|
|
|
|
name: ifcxt
|
|
version: 0.1.1
|
|
synopsis: put if statements within type constraints
|
|
description:
|
|
|
|
This package introduces the @ifCxt@ function,
|
|
which lets your write if statements that depend on a polymorphic variable's class instances.
|
|
For example, we can make a version of 'show' that can be called on any type:
|
|
|
|
.
|
|
|
|
> cxtShow :: forall a. IfCxt (Show a) => a -> String
|
|
> cxtShow a = ifCxt (Proxy::Proxy (Show a))
|
|
> (show a)
|
|
> "<<unshowable>>"
|
|
|
|
Running this function in ghci, we get:
|
|
|
|
.
|
|
|
|
>>> cxtShow (1 :: Int)
|
|
"1"
|
|
|
|
.
|
|
|
|
>>> cxtShow (id :: a -> a)
|
|
"<<unshowable>>"
|
|
|
|
.
|
|
|
|
See the project webpage http://github.com/mikeizbicki/ifcxt for more details.
|
|
|
|
homepage: http://github.com/mikeizbicki/ifcxt
|
|
license: BSD3
|
|
license-file: LICENSE
|
|
author: Mike Izbicki
|
|
maintainer: mike@izbicki.me
|
|
-- copyright:
|
|
category: Control
|
|
build-type: Simple
|
|
-- extra-source-files:
|
|
cabal-version: >=1.10
|
|
|
|
source-repository head
|
|
type: git
|
|
location: http://github.com/mikeizbicki/ifcxt
|
|
|
|
library
|
|
exposed-modules: IfCxt, IfCxt.Examples
|
|
-- other-modules:
|
|
default-extensions:
|
|
ConstraintKinds,
|
|
CPP,
|
|
Rank2Types,
|
|
FlexibleInstances,
|
|
FlexibleContexts,
|
|
TemplateHaskell
|
|
build-depends: base >=4.8, template-haskell >=2.10
|
|
hs-source-dirs: src
|
|
default-language: Haskell2010
|
|
|
|
test-suite test
|
|
default-language: Haskell2010
|
|
type: exitcode-stdio-1.0
|
|
hs-source-dirs: test
|
|
main-is: Main.hs
|
|
build-depends: base >= 4.8
|
|
, ifcxt
|
|
, QuickCheck
|
|
, tasty >= 0.7
|
|
, tasty-quickcheck
|