How can I pass some HList
as an argument? So I can make in a such way:
def HFunc[F, S, T](hlist: F :: S :: T :: HNil) {
// here is some code
}
HFunc(HList(1, true, "String")) // it works perfect
But if I have a long list, and I dunno nothing about it, how can I make some operations on it? How can I pass argument and not to loose its type?
It depends on your use-case.
HList
is useful for type-level code, so you should pass to your method not onlyHList
, but also all necessary information like this:For instance if you want to
reverse
yourHlist
andmap
over result you should useMapper
andReverse
like this:Usage: