Closed ocramz closed 2 years ago
I'm not sure I understood how this could be used -- an example would be good.
I attempted to derive Ord1 via Generically1 in test/Sym.hs, but wasn't able to. I'm not sure we can do that.
Secondly, Lang
is defined by the user of the library, so deriving Ord1
is on their court. If this Generically1 deriving worked, we could add it to the documentation as a suggested way to fulfill the constraint.
I attempted to derive Ord1 via Generically1 in test/Sym.hs, but wasn't able to. I'm not sure we can do that.
You will need GHC 9.4 for that. But as far as I can tell, there are missing instances in base:
There is an instance
instance (Generic1 f, Eq1 (Rep1 f)) => Eq1 (Generically1 f)
But there are no instances of Eq1
for (:*:)
, (:+:)
, (:.:)
, K1
, or M1
. Same for Ord1
. So it won't work.
@ocramz for Analysis
, see also #4 .
So it won't work
Okay, @ocramz, I'll close this issue for now.
With modern GHCs,
Generically1
is in base [1] and DerivingVia is available, so we canderiving Ord1 via Genericall1 Lang
.I think
Language
andAnalysis
could also be given default instances in this way, which would enable users ofhegg
to just derive empty instances and GHC would do the rest.(These are purely ergonomic improvements, which I find important but may be a matter of taste)
[1] https://hackage.haskell.org/package/base-4.17.0.0/docs/GHC-Generics.html#t:Generically1