proxied

Make functions consume Proxy instead of undefined

https://github.com/RyanGlScott/proxied

Version on this page:0.3.1
LTS Haskell 22.39:0.3.2
Stackage Nightly 2024-10-31:0.3.2
Latest on Hackage:0.3.2

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.3.1@sha256:25fb839cbe6b2adc54d5941e809fdafa1a4c072f8bb56f299e13728f1ccc5542,3326

Module documentation for 0.3.1

Depends on 1 package(full list with versions):

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 in the Data.Proxied. 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 wasn’t 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.

This library also contains the Data.Proxyless module, which works in the opposite direction. That is, one can take functions which take Proxy (or undefined) as an argument and convert them to functions which take no arguments. This trick relies on the -XTypeApplications extension, so it is only available with GHC 8.0 or later.

Changes

0.3.1 [2019.02.20]

  • Make the build warning-free under -Wcompat.

0.3

  • Update for GHC 8.2
    • Since typeRep#, typeNatTypeRep, and typeSymbolTypeRep are no longer exported from base, theTypeRep#, theTypeNatTypeRep, and theTypeSymbolTypeRep are now synonyms for theTypeRep
    • Happily, the new type signature for GHC.OverloadedLabels.fromLabel is now exactly the same as theFromLabel, so the latter is now a synonym for the former
  • Use explicit kind variable binders in Data.Proxyless
  • Use explicit foralls in Data.Proxied for consistency

0.2

  • Added the Data.Proxyless module
  • Added proxyHashed to Data.Proxied

0.1.1

  • Enabled Safe

0.1

  • Initial commit