
That instance seems fine to me.
It won't solve the general case of proxy arguments are those should
typically be type variables rather than fixed Proxy type, so using an
overloaded label would be ambiguous without a type signature:
example :: proxy a -> Int
So if you were designing an API intended to be used with an overloaded
label it would probably make sense to pick a different type and just define
the instance locally:
data StringProxy (str :: Symbol) = StringProxy; instance x ~ a => IsLabel x
(StringProxy a) where fromLabel = StringProxy
since you were building an API intended to be used with overloaded labels.
The user would find this less surprising as you'd be able to attach
documentation to StringProxy explaining how it was intended to be used.
-Eric
On Tue, Jul 7, 2020 at 1:48 AM Fumiaki Kinoshita
I propose adding an IsLabel instance to Proxy where
fromLabel = Proxy
This is the only reasonable instance I can think of, and AFAIK there's no plan which would conflict [0].
The proposed instance allows us to explore API designs involving type-level strings with much less syntactic noise ( #foo is easier to type than @"foo"). I admit that the motivation is weak, but I think it's nice to have.
[0] https://gitlab.haskell.org/ghc/ghc/-/wikis/records/overloaded-record-fields/... _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
-- Eric Mertens