Closed aspiwack closed 5 years ago
Tags are poly-kinded. So, in such cases, we could use the type as a tag as well.
For example:
type HasState' s = HasState s s
data Config = ...
foo :: HasState' Config m => m ()
foo = ...
Uh. Please no! Not doing that is sort of the entire point of tags to begin with.
Currently, we have to write
This is all fine for library, and basically necessary for deriving-via combinators. But it's a bit annoying in an application. Where typically, a tag correspond to a given type. e.g.
HasReader "config"
would always be followed by the same configuration type. Throughout the entire application. Meh :slightly_frowning_face: .We should do something about this.
At this point my idea looks a bit as follows. We define a type family
(with no instance in the library)
And type synonyms like
This way, you could define application-wide tag-to-type associations and have shorthands for them.
Or maybe, in order to avoid the lack of composability that symbol have, we could do
That way they can be defined without orphan instances.
Thoughts?