About

Metadata

  • Last updated , by MikeIzbicki
  • License BSD-3-Clause
  • Maintained by: mike@izbicki.me

  • Lottery factor: 0

Links

Installation

Readme

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:

>>>
>>>

See the project webpage http://github.com/mikeizbicki/ifcxt for more details.