The ifcxt package

[Tags:bsd3, library, test]

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 for more details.


Versions, 0.1.1
Dependencies base (==4.8.*), template-haskell (==2.10.*) [details]
License BSD3
Author Mike Izbicki
Category Control
Home page
Source repository head: git clone
Uploaded Wed Aug 3 21:52:43 UTC 2016 by MikeIzbicki
Distributions NixOS:0.1.1
Downloads 194 total (32 in the last 30 days)
1 []
Status Docs not available [build log]
All reported builds failed as of 2016-11-21 [all 2 reports]
Hackage Matrix CI


  • IfCxt
    • IfCxt.Examples


Maintainer's Corner

For package maintainers and hackage trustees