You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for this boost getting started with type class derivation! I have a product case classes with various Map types and of course I can easily define a derive for each higher order kind, such as:
// not too too bad...givenmapRandIntStr:Random[Map[Int, String]] with { defproduce:Map[Int, String] =Map(0->"test") }
// if only it were this easy....givenmapRand[K:Random, V:Random]:Random[Map[K, V]] =Random.derived
I understand Map type isn't really a (nested) product, and so you'd probably have to get at the underlying list of Tuple in order to properly derive it (actually this is mentioned subtly here). At the same time, writing a given for every single variation of Map[K,V] is a bit nightmare-ish too!
Do you have any thoughts on how this could be done, treating Map[K,V] as a nested Random as succinctly as possible?
The text was updated successfully, but these errors were encountered:
Hi, thanks for this boost getting started with type class derivation! I have a product case classes with various
Map
types and of course I can easily define aderive
for each higher order kind, such as:I understand
Map
type isn't really a (nested) product, and so you'd probably have to get at the underlying list ofTuple
in order to properlyderive
it (actually this is mentioned subtly here). At the same time, writing agiven
for every single variation ofMap[K,V]
is a bit nightmare-ish too!Do you have any thoughts on how this could be done, treating
Map[K,V]
as a nestedRandom
as succinctly as possible?The text was updated successfully, but these errors were encountered: