scala - Unable to map on HList -


I was trying to solve with formless though I was unable to map 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)   

error message is:

  & 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>  

Why does not mapping work?

An easy fix: Just type 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}   

(note I have named the f function instead of map to avoid confusion with Mapper .)

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

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -