These are chat archives for boostorg/hana

8th
Nov 2017
Alastair Rankine
@randomphrase
Nov 08 2017 00:03
Yeah I think I had attempted something similar using adjust_if(my_tuple{}, [] (auto p) { return !hana::Sequence<decltype(p)>::value; }, hana::just) but it didn’t work.
In my mind I guess I had anticipated that flatten would work the way it does in lisp... maybe I’ll have to rethink this.
Jason Rice
@ricejasonf
Nov 08 2017 00:10
Hana is particular about its inputs belonging to the same classification. For instance, you can't concat an std::tuple and a hana::tuple. You can't even add constants of int and unsigned int. It may seem impractical at first, but I've grown to prefer it.
adjust_if makes sense, but you are using hana::just which returns hana::optional. Could that be the problem there?
Alastair Rankine
@randomphrase
Nov 08 2017 14:49
Yeah I couldn’t get adjust_if didn’t work because it ended up wrapping everything in a hana::optional, even though my predicate correctly detected sequences and returned false accordingly. So I ended up with a tuple of hana::optional<std::tuple<hana::type<A>, hana::type<B>>>, hana::optional<hana::type<C>>
Is there an online compiler with hana? Perhaps I can post a snippet if anyone is interested.
Jason Rice
@ricejasonf
Nov 08 2017 16:32
Yes, you gave it the function hana::justas the third argument. I would use hana::make_tuple. ;)
Alastair Rankine
@randomphrase
Nov 08 2017 16:57
@ricejasonf Yeah I tried that too... Ended up with hana::tuple<std::tuple< ... >>. I’ll post a snippet to wandbox soon (thx @apmccartney)