proxy-kindness: A library for kind-polymorphic manipulation and inspection of Proxy values

[ bsd3, data, library ] [ Propose Tags ]

It can be useful (especially with PolyKinds) to get the "bare" type (e.g. Either) of some parameterized type (e.g. Either Char Int). This library provides closed classes that can strip and reapply type arguments, as well as useful utility functions. Here are some examples:

Force Left 1 to be of type Either Float a using a partially-applied Proxy.

>>> let t = (Left 1) `asApplied` (Proxy :: Proxy (Either Float))
>>> :t t
t :: Either Float a

Do the same, but illustrating type application with ap

>>> let t0 = (Left 1) `asApplied` ((Proxy :: Proxy Either) `ap` (Proxy :: Proxy Float))
>>> :t t0
t0 :: Either Float a

Force polymorphic undefined to some polymorphic Either type, the base type of t defined above.

>>> let u = undefined `asApplied` (unappliedOf t)
>>> :t u
u :: Either a a1

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1
Dependencies base (>=4.6 && <4.7), tagged [details]
License BSD-3-Clause
Author Brandon Simmons
Maintainer brandon.m.simmons@gmail.com
Category Data
Home page https://github.com/jberryman/proxy-kindness
Source repo head: git clone https://github.com/jberryman/proxy-kindness.git -b master
Uploaded by BrandonSimmons at 2013-11-15T02:19:41Z
Distributions
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 1135 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]