proxied 0.3 → 0.3.1
raw patch · 5 files changed
+32/−10 lines, 5 files
Files
- CHANGELOG.md +3/−0
- README.md +1/−1
- proxied.cabal +5/−3
- src/Data/Proxied.hs +22/−5
- src/Data/Proxyless.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,6 @@+### 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
README.md view
@@ -17,6 +17,6 @@ `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` 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.+ `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.
proxied.cabal view
@@ -1,5 +1,5 @@ name: proxied-version: 0.3+version: 0.3.1 synopsis: Make functions consume Proxy instead of undefined description: @proxied@ is a simple library that exports a function to convert constant functions to ones that take a @proxy@@@ -15,7 +15,7 @@ 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+ 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@@ -44,7 +44,9 @@ , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2- , GHC == 8.2.1+ , GHC == 8.2.2+ , GHC == 8.4.4+ , GHC == 8.6.3 extra-source-files: CHANGELOG.md, README.md cabal-version: >=1.10
src/Data/Proxied.hs view
@@ -11,6 +11,10 @@ {-# LANGUAGE PolyKinds #-} #endif +#if __GLASGOW_HASKELL__ >= 800 && __GLASGOW_HASKELL__ < 806+{-# LANGUAGE TypeInType #-}+#endif+ {-# OPTIONS_GHC -fno-warn-deprecations #-} {-|@@ -78,6 +82,9 @@ import Data.Bits (Bits(..)) import Data.Data hiding (Fixity)+#if MIN_VERSION_base(4,9,0)+import Data.Kind (Type)+#endif import Data.Proxy import Foreign.Storable (Storable(..))@@ -171,7 +178,11 @@ -- On @base-4.7@ and later, this is identical to 'typeRep'. -- -- /Since: 0.1/-typeOfProxied :: forall proxy+typeOfProxied :: forall+#if MIN_VERSION_base(4,9,0)+ k+#endif+ proxy #if MIN_VERSION_base(4,7,0) (a :: k) #else@@ -204,14 +215,20 @@ -- GHC.Generics ------------------------------------------------------------------------------- -#define GENERIC_FORALL(t,letter) forall proxy T_TYPE(t) letter f a+#define GENERIC_FORALL(t,letter) forall K_KINDS proxy T_TYPE(t) letter f a +#if MIN_VERSION_base(4,9,0)+# define K_KINDS k1 k2+#else+# define K_KINDS+#endif+ #if MIN_VERSION_base(4,10,0)-# define T_TYPE(t) (t :: k1 -> (k2 -> *) -> k2 -> *)+# define T_TYPE(t) (t :: k1 -> (k2 -> Type) -> k2 -> Type) #elif MIN_VERSION_base(4,9,0)-# define T_TYPE(t) (t :: k1 -> (* -> *) -> k2 -> *)+# define T_TYPE(t) (t :: k1 -> (Type -> Type) -> k2 -> Type) #else-# define T_TYPE(t) (t :: * -> (* -> *) -> * -> *)+# define T_TYPE(t) (t :: * -> (* -> *) -> * -> *) #endif -- | @'datatypeNameProxied' = 'proxied' 'datatypeName'@
src/Data/Proxyless.hs view
@@ -296,7 +296,7 @@ theSelDecidedStrictness = selDecidedStrictness @s undefined ---------------------------------------------------------------------------------- GHC.Generics+-- GHC.OverloadedLabels ------------------------------------------------------------------------------- -- | In @base-4.10@ and later, this is simply a synonym for 'fromLabel'.