Proposal: relax type of asProxyTypeOf
Daniel Wagner
dmwit at galois.com
Tue Nov 25 23:53:42 UTC 2014
In base, the new Data.Proxy module has this handy function:
asProxyTypeOf :: a -> Proxy a -> a
asProxyTypeOf = const
This is nice for restricting the phantom type variable of a Proxy that
you have lying around. This use could be generalized to other types with
phantom type variables by making the type slightly more polymorphic:
asProxyTypeOf :: a -> proxy a -> a
Since phantom type variables are a very common pattern, this would make
asProxyTypeOf more generally useful.
Possible downside: it may be that somebody used asProxyTypeOf to
restrict both the phantom type and the "Proxy" type, and that the more
polymorphic type for asProxyTypeOf would cause that code to break. I
find this pretty unlikely. Perhaps the folks behind the "tagged" package
could mention whether this complaint ever came up when it made a similar
generalization.
~d
More information about the Libraries
mailing list