function - Scala Function1 Generic parameter and return type -


lets want store map[string, function1] parameter , return type of function1 can vary. how go storing function1[string, string] , function1[int, int] in same map.

i've tried function1[anyref, anyref] function1[string, string] isn't function1[anyref, anyref] fails compile.

if have 2 possible value types, can wrap values in either:

val m = map[string, either[int => int, string => string]]() 

if want store more 2 different types, create own wrapper, or use coproduct shapeless.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -