scala - Unable to map on HList -
I was trying to solve with formless though I was unable to map error message is: Why does not mapping work? An easy fix: Just type (note I have named the Not sure why I can help with why at some point why I will not work for such things in mourningless, and I do not remember that How far i got HList For some reason I'll call the code for myself.
imported waste. _ Import HList._ Case class Fu (A: Option [int], B: option [int]) val a = Foo (some (3), none) val b = fu (some (22), some (1 )) Voodoo voo fooIso = HListIso (Foo.apply _, Foo.unapply _) val on map = new (({{O2 type [A] = (option [A], option [A])}) # O2 ~> Option {def} [A] (X: (option [A], option [A])): Option [A] = X._1.orElse (x._2)} fooIso.fromHList (fooIso.toHList (a) Zip (fooIso.toHList (b)). Map (mapper)
& lt; console & gt; 55: error : The value for the parameter mapper could not be found: the sizeless mapper [useless With java.lang.Object. ~ & Gt; [[+ A] (option [A], option [A]), option [], useless. :: [(option [int], option [int]), useless .: :( (option [sign], option [int]), useless .HNil]]] fooIso.fromHList (fooIso.toHList (a) .zip (fooIso.toHList (b)). Map (mapper) ^ < / Code>
object as
val :
as an extension of the object F (({{O2 [+ A ] = (Option [A], option [A])}) # o2 ~> Option) {DIF A [A] (X: option [A], option [A])): Option [A] = x._1 or alse x._2}
f function instead of
map to avoid confusion with
Mapper .)
Comments
Post a Comment