proxied: Make functions consume Proxy instead of undefined

[ bsd3, data, library ] [ Propose Tags ]

proxied is a simple library that exports a function to convert constant functions to ones that take a proxy value. This is useful for retrofiting typeclasses that have functions that return a constant value for any value of a particular type (but still need to consume some value, since one of the parameterized types must appear in a typeclass function). Often, these functions are given undefined as an argument, which might be considered poor design.

Proxy, however, does not carry any of the error-throwing risks of undefined, so it is much more preferable to take Proxy as an argument to a constant function instead of undefined. Unfortunately, Proxy was included in base until GHC 7.8, so many of base's typeclasses still contain constant functions that aren't amenable to passing Proxy. proxied addresses this issue by providing variants of those typeclass functions that take an explicit proxy value.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.2, 0.3, 0.3.1
Change log CHANGELOG.md
Dependencies base (>=4.3 && <5), generic-deriving (>=1 && <2), tagged (>=0.4.4 && <1) [details]
License BSD-3-Clause
Copyright (C) 2016 Ryan Scott
Author Ryan Scott
Maintainer Ryan Scott <ryan.gl.scott@gmail.com>
Category Data
Home page https://github.com/RyanGlScott/proxied
Bug tracker https://github.com/RyanGlScott/proxied/issues
Source repo head: git clone https://github.com/RyanGlScott/proxied
Uploaded by ryanglscott at 2016-02-18T04:10:21Z
Distributions LTSHaskell:0.3.1, NixOS:0.3.1, Stackage:0.3.1
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 3814 total (23 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-02-18 [all 1 reports]

Readme for proxied-0.1

[back to package description]

proxied

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build

proxied is a simple library that exports a function to convert constant functions to ones that take a proxy value. This is useful for retrofiting typeclasses that have functions that return a constant value for any value of a particular type (but still need to consume some value, since one of the parameterized types must appear in a typeclass function). Often, these functions are given undefined as an argument, which might be considered poor design.

Proxy, however, does not carry any of the error-throwing risks of undefined, so it is much more preferable to take Proxy as an argument to a constant function instead of undefined. Unfortunately, Proxy was included in base until GHC 7.8, so many of base's typeclasses still contain constant functions that aren't amenable to passing Proxy. proxied addresses this issue by providing variants of those typeclass functions that take an explicit proxy value.