I've been thinking that defaultTo is too blunt of a tool to be effectively wielded. What do you think about changing its type signature to:
defaultTo :: Signature -> proxy a -> Signature
where a becomes the default only within the scope of the signature argument.
I think this might clean up the problems around putting polymorphic constrained constructors into the background, like in #66. We could do something like this:
monoid :: Sig
monoid = background $ defaultTo
[ con "mempty" $ liftC @(Monoid A) $ mempty @A
, con "<>" $ liftC @(Monoid A) $ (<>) @A
, instanceOf @(Monoid [Int])
] (Proxy @[Int])
I'd be happy to send a PR if you think this is an avenue worth pursuing.
I've been thinking that
defaultTo
is too blunt of a tool to be effectively wielded. What do you think about changing its type signature to:where
a
becomes the default only within the scope of the signature argument.I think this might clean up the problems around putting polymorphic constrained constructors into the background, like in #66. We could do something like this:
I'd be happy to send a PR if you think this is an avenue worth pursuing.