proxied

Make functions consume Proxy instead of undefined

https://github.com/RyanGlScott/proxied

Version on this page:0.1.1
LTS Haskell 22.17:0.3.1
Stackage Nightly 2024-04-14:0.3.1
Latest on Hackage:0.3.1

See all snapshots proxied appears in

BSD-3-Clause licensed by Ryan Scott
Maintained by Ryan Scott
This version can be pinned in stack with:proxied-0.1.1@sha256:e601f346afeffefccd1b628e8947e3d9d83e7550e638396ad29c3a51c736a69a,2595

Module documentation for 0.1.1

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.

Changes

0.1.1

  • Enabled Safe

0.1

  • Initial commit