Several packages on Hackage declare this or similar (search Hoogle for a -> Proxy a
):
mkProxy :: a -> Proxy a
mkProxy _ = Proxy
Data.Proxy
has no such thing, but does include
asProxyTypeOf :: a -> proxy a -> a
asProxyTypeOf = const
Similar usage to Prelude.asTypeOf
; so typically used infix; and note the lower-case proxy
.
(There is a Monoid
instance with mempty = Proxy
.)
Is there some deep reason why mkProxy
should be frowned on? For example: its first argument would have to be a value, whereas Proxy
is all about types divorced from values.