These are chat archives for boostorg/hana

31st
Aug 2016
Louis Dionne
@ldionne
Aug 31 2016 01:07
@hia3 No, an exception can’t be made. It would be equivalent to saying that a std::set<T> with a single element is a SequenceContainer, because it happens to have a single element.
The fact that a std::set has a single element is a runtime property, while the concepts that it model is a property of the type system, which allows you to reason about your code.
Hana’s type system is its tag dispatching system, and the contents of a container is not part of that.
Even though we could technically do it because all of it is known at compile-time, it is very important that we enforce this phase distinction so that we can stay sane when writing code with Hana.
So, as always, the question is: what are you trying to achieve?
hia3
@hia3
Aug 31 2016 16:19
@ricejasonf @ldionne Here is what I'm trying to do - http://melpon.org/wandbox/permlink/ENjifTuFiXkAFB6j I don't like that to_tuple call.
Jason Rice
@ricejasonf
Aug 31 2016 17:50

The items contained in a set have no specified order so you can't technically rely on any one item being in "front". That being said you could use unpack since set is Foldable. Something like:

hana::unpack(my_set, hana::arg<1>);

This would fail just like hana::front would if the set was empty.

Jason Rice
@ricejasonf
Aug 31 2016 18:01
It doesn't sound like a job for set though.
Are you just trying to get unique types?
hia3
@hia3
Aug 31 2016 20:13
@ricejasonf Thanks. Yes, I'm trying to get unique types, but hana::unique does not work on clang :smile:
Jason Rice
@ricejasonf
Aug 31 2016 20:16
I have a fork that works around the clang bug for c++1z, but folding with hana::insert is better because (I think) unique requires sorted or already grouped values.
Using insert is what I did in the above link.