Commit Graph

50 Commits

Author SHA1 Message Date
Louis Dionne
d2ef6cc3b0 Fix some erroneous usages of BOOST_HANA_CONSTEXPR_LAMBDA that went unnoticed 2017-07-22 13:13:04 -07:00
Louis Dionne
9895803ede Bump copyright year to 2017 2017-01-07 14:14:18 -08:00
Louis Dionne
23c3edc93b [NFC] Un-Doxygenize comments in non-header files 2016-02-04 11:07:41 -05:00
Louis Dionne
c41a5cb6be Update copyright notices for 2016 2016-01-01 14:54:06 -05:00
Louis Dionne
3707877225 [Iterable] Remove the tail function
Closes #158
2015-11-11 14:08:36 -05:00
Louis Dionne
05f3763ef6 [Example] Add missing includes 2015-10-08 15:37:30 -04:00
Louis Dionne
423bc7220a [MonadPlus] Rename repeat to replicate 2015-09-07 22:43:35 -04:00
Louis Dionne
5cec8b3e2e [tuple] Rename Tuple to tuple_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
4e3d17bd3b [Core] Do not use a nested ::hana struct to hold the tag.
This was annoying because

(1) We couldn't use the name hana:: from within the struct
(2) It requires one more instantiation unless you use the
    `using hana = self` trick. But that trick makes something
    that should be trivial to do slightly harder, and that is stupid.
2015-09-02 21:59:03 -04:00
Louis Dionne
f3d9df96d0 [Core] Rename datatype<> to tag_of<>
Also, rename the nested hana::datatype alias to hana::tag.
2015-09-02 21:59:03 -04:00
Louis Dionne
08f66d47c1 [IntegralConstant] Suffix variable templates with _c, and clean up type names
Along with PR #166, this closes #122 because names have now been
cleaned up and are now consistent basically everywhere.
2015-09-01 16:34:04 -04:00
Louis Dionne
f373b421f9 [Headers] Minimize the #includes in headers
- Allow specializing models_impl with a forward declaration only
- Modularize remaining concept headers
- Include <boost/hana.hpp> in unit tests to ease the transition
- Add the core/dispatch.hpp header to reduce the number of boilerplate includes
2015-08-26 11:27:28 -04:00
Louis Dionne
08b3db1708 [Examples] Modularize and use qualified names
This patch modularizes the examples, makes them self-contained and
also uses qualified hana:: names.

Fixes #139
Fixes #126
2015-08-15 17:50:40 +02:00
Louis Dionne
d3b7cb2c85 Modularize the headers
This (large) commit introduces the following changes:
- Each algorithm lives in its own header
- The concepts are defined in the concept/ subdirectory. They define the
  `models` metafunction, some explicit default implementations (like
  Applicative::transform_impl), and they include all the algorithms
  related to that concept.
- Removed the `until` method from Logical
- Removed the `drop_until` method from Iterable
- [minor] Added the detail::nested_to utility

Closes #160
2015-07-25 16:20:47 +02:00
Louis Dionne
c6045da6ee [Sequence] Use underscores instead of dots to name zip variants
Also, remove unzip since it is easily implemented with unpack and zip.

Addresses #114
2015-06-28 11:43:29 +02:00
Louis Dionne
09955bf1b7 Use drop_front/drop_back front/back instead of asymmetrical names
- Replace init by drop_back and drop_back_exactly
- Rename head to front
- Rename last to back, and also rewrite the default implementation
  in terms of at instead of using (inefficient) recursion.
- Rename drop[_exactly] to drop_front[_exactly]
- Remove drop_c

Note that tail is kept for the moment because it is part of Iterable's
MCD. Removing tail will be the subject of a different issue.

Fixes #66
2015-06-28 10:44:28 +02:00
Louis Dionne
4bef99d3d0 [Core] Completely remove operators from the core
Properly providing operators for users was too complicated, and it is
judged as being out of Hana's scope.

Instead, operators are now provided by helper classes in the detail::
namespace. Now, we can be as dirty as we want, since it is not part of
the interface anymore.

Fixes #138
Closes #30
2015-06-20 17:56:40 -04:00
Louis Dionne
1022f74fa7 Remove our partial <type_traits> reimplementation
There was a legitimate reason to have this duplication when the library
was much smaller. However, hovering at about 30 kLOCs, the library is
definitely not small enough anymore to mandate reimplementing our own
<type_traits>. Also, most user code will probably include <type_traits>
anyway, so using <type_traits> will not increase the overall compilation
time in actual code bases.

Finally, this gives us much more flexibility, like the ability to
inherit our IntegralConstant from std::integral_constant, and then
return that from the traits:: metafunctions, so that operators can
be used with them.
2015-06-12 12:49:22 -04:00
Louis Dionne
07f15e171f Normalize the parameter order of take, suffix, remove_at, cycle and repeat
Closes #83
2015-06-04 22:29:13 -04:00
Louis Dionne
077dc7b6c9 [Iterable] Normalize parameter order for at and drop
Partially addresses #83
2015-06-04 21:13:51 -04:00
Louis Dionne
0660af6a8f [GCC] Initial port to GCC
- Fix ambiguous specialization in core/datatype
- [Config] Turn #errors into #warnings
- Qualify recursive calls to `apply` to make sure the right function is selected
- Remove usages of when_valid to workaround ambiguous specializations
- Use multiline comments to remove some GCC warnings with LaTeX's double backslash
- Specialize operators::of in the boost::hana::operators namespace
- Manually perform more conversions in constexpr-context
- Workaround the lack of support for constexpr-but-non-const member functions
- Disambiguate unqualified uses of size_t with hana::size_t and ::size_t
2015-05-20 16:56:34 -04:00
Louis Dionne
aaaab0e11d [Foldable] Allow specifying the Monoid/Ring for sum/product
Fixes #33
2015-04-01 16:19:37 -04:00
Louis Dionne
bd4daea264 Use models<Concept, T> instead of models<Concept(T)>, and check data types at the top level 2015-03-07 21:27:46 -05:00
Louis Dionne
065b910128 Update copyright year. 2015-03-03 14:16:50 -05:00
Louis Dionne
f017c4493a [Searchable] Swap {all,any,none} and their _of variant for consistency with the STL 2015-03-03 13:51:37 -05:00
Louis Dionne
edd086423e [Tuple] Replace tuple(...) by make<Tuple>(...) in the docs 2015-02-24 18:15:24 -05:00
Louis Dionne
3e78af4bcb [Tuple] Use make<Tuple>(...) instead of tuple(...) 2015-02-22 16:50:01 -05:00
Louis Dionne
62ede37419 Rename fmap to transform 2015-02-22 14:55:35 -05:00
Louis Dionne
9e67213857 Rename zip_with to zip.with 2015-02-22 14:55:35 -05:00
Louis Dionne
734f89190c [Core] Refactor the operator system 2015-02-20 11:05:44 -05:00
Louis Dionne
9604c9a9f6 Replace List by Sequence 2015-02-20 11:05:43 -05:00
Louis Dionne
737f20a5bb [models] Implement models for each concept; no need to explicitly specialize it 2015-02-15 10:31:12 -05:00
Louis Dionne
8a3e5f794d [Functor] Refactor documentation and split methods 2015-02-10 20:34:41 -05:00
Louis Dionne
17d2ce584c [Integral] Rename to IntegralConstant and improve the API 2015-02-10 20:03:49 -05:00
Louis Dionne
dab93cc263 [Comparable] Update docs, split methods and more
- Use == for cross-type EqualityComparable data types
- Remove the not_equal mcd
2015-02-10 19:18:40 -05:00
Louis Dionne
1d3aaa93c4 [Monoid up to IntDomain] Refactor the documentation and split the methods 2015-02-10 18:03:42 -05:00
Louis Dionne
04985812f8 [Range] Specify what happens when from and to have different underlying types 2015-02-10 18:03:19 -05:00
Louis Dionne
4654c6786a Split instances for foreign types 2014-12-06 16:30:16 -05:00
Louis Dionne
8d4b34f6c2 Do not use variable templates for one, zero & al.
This is because using variable templates limits the objects to being
constexpr, or to not being constexpr (but then initializing the object
becomes an issue).

This is also a step towards being compilable by GCC 4.9, but that only
would not justify the change.
2014-11-30 20:42:29 -05:00
Louis Dionne
ec8e7446a0 CppCon Matrix: Implement the one method 2014-11-30 11:38:48 -05:00
Louis Dionne
f0919d1761 Use List::repeat instead of handwritten one in the Matrix example. 2014-11-30 11:38:48 -05:00
Louis Dionne
8756e81977 Add boost/hana/config.hpp and BOOST_HANA_*_CHECK macros. 2014-11-10 17:52:33 -05:00
Louis Dionne
049046478e Move ASSERT macros out of the details 2014-11-04 09:43:44 -05:00
Louis Dionne
788b4df735 List: zip_with and zip must receive lists of the same data type 2014-11-04 08:54:59 -05:00
Louis Dionne
eddece8d00 Use the nested hana struct to define enabled operators. 2014-10-27 16:31:03 -04:00
Louis Dionne
220d92ed82 Use a nested hana struct to customize stuff inside user defined objects. 2014-10-27 15:24:14 -04:00
Louis Dionne
b26406d649 Simplify the header hierarchy: too modular isn't good.
This essentially undo parts of 307d3d0. While it seemed a like good
idea to over-modularize type classes to reduce header dependencies, I
think it was a mistake. What 307d3d0 did was basically split each of
the components of a type class into a single header (typeclass/operators.hpp,
typeclass/mcd_1.hpp, typeclass/mcd_2.hpp, ...).

At first, it resolved many weird header dependency glitches. However, it
also made everything more complex; creating even easy type classes was
sometimes much longer than it should have been, and using type classes
was tricky because you had to know exactly what to include. It also went
against the idea of implicit type class instances being provided whenever
that's possible, which I think is a nice feature of the library. Being
dissatisfied with this, I opted for a simpler header organization with
a fwd/ directory that contains forward declaration headers, and everything
else in the same directory.

A possible objection to this change would be that you are now forced
to include sometimes more than what you strictly need when e.g. defining
an instance or using only some instance(s) of a data type. My answer to
this is that Hana is a really small library and the parsing is not
going to have a huge impact on overall compilation time. My bet is that
the time that will be saved by programmers with a simple header hierarchy
outweights the parsing time by far.
2014-10-25 09:47:05 -04:00
Louis Dionne
a7b28bddd8 Add more perfect forwarding and do some refactoring. 2014-10-02 21:05:01 -04:00
Louis Dionne
18fef19050 List: add the repeat method 2014-09-11 08:22:12 -07:00
Louis Dionne
7a3dd8ae8a Example: Add the homogeneous Matrix example for CppCon. 2014-09-04 09:30:12 -04:00