Commit Graph

148 Commits

Author SHA1 Message Date
Louis Dionne
fd5e3ca715 [Concepts] Define concepts as template structs instead of using models<>
The `models<>` machinery added unnecessary complexity for little benefit.
Also, this makes Hana's concepts syntactically closer to concepts lite,
which should contribute to making them easier to grasp at first sight.
2015-09-05 19:25:01 -04:00
Louis Dionne
673a84c787 [ext/] Rename tags to xxx_tag for external adapters 2015-09-03 13:29:17 -04:00
Louis Dionne
5cec8b3e2e [tuple] Rename Tuple to tuple_tag 2015-09-02 21:59:04 -04:00
Louis Dionne
c52c6d88d4 [Doc] Adjust the documentation to use "tag" instead of "data type" when it makes sense 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
28d85747a4 [std::tuple] Fix unit tests broken by 08f66d4
The unit tests were not being run, because they are disabled for
clang < 3.7.0 due to bugs in libc++
2015-09-02 21:47:28 -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
c2ed70ddf9 [Doc] Document hana::type instead of hana::Type
Precisely,
1. Rename hana::_type to hana::basic_type, and document it
2. Rename hana::type<> to hana::type_c<>
3. Create and document the hana::type<> type
2015-08-30 17:08:06 -04:00
Louis Dionne
d0492da082 [Doc] Document hana::integral_constant instead of hana::IntegralConstant 2015-08-30 17:07:19 -04:00
Louis Dionne
af01c3a0d4 [Tests] Use hana:: qualified names 2015-08-28 11:32:09 -04:00
Louis Dionne
5b530824fe [GCC] Workaround bugs and warnings
- Fix ambiguous overload of `concat` for Optionals
- Fix compilation error in std::vector unit test
- Fix false positives related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66543
- Fix compilation error caused by variable template initialized by a lambda
2015-08-28 10:21: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
0893ae57f7 [Fusion adapters] Don't test the full laws, only the implemented methods
The Fusion adapters have been giving me trouble for a long time now.
The problem is that Hana's unit tests are more thorough than Fusion's,
and hence we keep uncovering Fusion bugs through Hana's unit tests.
This keeps on breaking the build and makes me lose valuable time trying
to workaround these bugs until they are fixed in Fusion's master branch.

Therefore, only the methods that are implemented by Fusion adapters are
tested to make sure they work as expected, but the other algorithms that
are derived from them are not tested on Fusion adapters.
2015-07-26 12:42:20 +02:00
Louis Dionne
6f73c881b3 [ext::boost::Tuple] Workaround non-variadic implementation of boost::tuple
Yeah, this is a cheap workaround, but I'm not going to lose any time
with this old cruft. Sorry.
2015-07-25 16:20:48 +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
9928dea216 [Traversable] Remove that concept entirely
That concept was added more for completeness than for actual usefulness,
since I have not used it a single time since its creation. Given the
complexity of the library, I think it is better to remove it and shrink
the library to a more useful core than giving too many features that
contribute to bloat.

Also, the laws were difficult to check and it hence Traversable models
were not very well tested anyway.

I can always roll this back if someone shows me how Traversable is
actually useful for metaprogramming.
2015-06-10 10:07:55 -04:00
Louis Dionne
fc18a6cc21 [ext/fusion] Increase MAX_VECTOR_SIZE to fix failing tests 2015-05-06 18:59:05 -04:00
Louis Dionne
9a412f9c39 [MPL] Add a conversion from Foldables to MPL vectors
Also, properly split the unit tests for mpl::vector
2015-04-26 14:20:15 -04:00
Louis Dionne
93343e8317 [Tests] Send objects containing Logicals only to the Searchable tests 2015-04-11 13:45:55 -04:00
Louis Dionne
c434f134ba [Applicative] Implement automatic law checking 2015-04-10 13:17:51 -04:00
Louis Dionne
a12315c1a6 [Detail] Add constexpr algorithms and use them in the implementation 2015-04-10 08:33:18 -04:00
Louis Dionne
17169d99d3 [Constant] Document conversions, embeddings and related material. Fix TODOS 2015-04-09 11:18:03 -04:00
Louis Dionne
40216cde23 [MonadPlus] Add the remove and remove_if functions to MonadPlus 2015-04-07 16:27:39 -04:00
Louis Dionne
f92be805d0 [fusion::vector] Split the tests for Sequence 2015-03-25 16:19:11 -04:00
Louis Dionne
8238bc4c38 [Tests] Re-enable unbroken Fusion tests 2015-03-24 16:21:07 -04:00
Louis Dionne
dfa46fcd69 [Test] Properly split std::tuple's Sequence unit tests 2015-03-24 14:57:41 -04:00
Louis Dionne
224bc2cf9a [Tests] Split the unit tests for mpl::integral_c 2015-03-22 21:06:37 -04:00
Louis Dionne
41914809a2 [Travis/Test] Clean up and modularization
- Properly setup build matrix
- Clean up .travis.yml
- Try building with Boost 1.57 and Boost 1.58
- Install dependencies to the deps/ subdirectory
- Reduce memory usage of test/type.cpp
- Re-enable some Fusion tests
2015-03-19 12:45:26 -04:00
Louis Dionne
52afb17a43 [Tests] Split unit tests in a much more clever way using CMake 2015-03-18 19:28:21 -04:00
Louis Dionne
744ac273b4 [ext/std/vector] Monomorphic => can't be a Functor 2015-03-15 00:18:31 -04:00
Louis Dionne
1b8b5a5e2f [ext/std/array] Can't be made a Sequence because it's homogeneous 2015-03-15 00:18:31 -04:00
Louis Dionne
bcf573ccc6 [Functor] Rename adjust to adjust_if and add adjust 2015-03-15 00:18:30 -04:00
Louis Dionne
356a1991b3 [Travis] Remove some MCD tests on Travis because we timeout/OOM 2015-03-13 12:16:34 -04:00
Louis Dionne
97f27661cb [Tests] Split the unit tests for std::ratio and Either, and reduce hungry tests 2015-03-11 11:46:19 -04:00
Louis Dionne
656b57e80b [ext/utility] Add traits::declval 2015-03-10 09:30:07 -04:00
Louis Dionne
6c076555a5 [ext/] Fix std::integer_sequence and mpl::vector failing tests 2015-03-08 11:56:27 -04:00
Louis Dionne
4b44e867e1 [ext/] Add an experimental adapter for std::vector 2015-03-05 20:00:21 -05:00
Louis Dionne
5216569ef2 [Tests] Split more unit tests 2015-03-05 16:57:37 -05:00
Louis Dionne
cc76ebbba2 [IntegralDomain] Use rem instead of mod, and change laws so it's consistent with % 2015-03-05 12:25:50 -05:00
Louis Dionne
479f5ef991 [Tests] Split more unit tests 2015-03-05 10:34:15 -05:00
Louis Dionne
b229a60e25 Refactor the automatic law checking to make it more modular 2015-03-05 09:35:06 -05:00
Louis Dionne
065b910128 Update copyright year. 2015-03-03 14:16:50 -05:00
Louis Dionne
da5c1a1ef1 [Ext] Re-add the old type_traits integration 2015-03-02 16:13:55 -05:00
Louis Dionne
7e2bcdfee0 [ext/mpl] MPL vectors are not Sequences anymore 2015-02-27 11:34:21 -05:00
Louis Dionne
33cba2dea8 [MplVector] Fix broken include in unit test 2015-02-25 09:19:59 -05:00
Louis Dionne
c13f660ecc [MonadPlus] Add signatures and rename nil to empty 2015-02-25 09:19:58 -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
d120513366 Rename cons to prepend and snoc to append 2015-02-22 14:55:35 -05:00
Louis Dionne
9604c9a9f6 Replace List by Sequence 2015-02-20 11:05:43 -05:00
Louis Dionne
17d2ce584c [Integral] Rename to IntegralConstant and improve the API 2015-02-10 20:03:49 -05:00
Louis Dionne
88549c004c [IntegralConstant] Remove the concept 2015-02-10 19:18:40 -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
d6ef326e94 [Product] Split methods, refactor doc and add Orderable instance 2015-02-08 10:43:12 -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
4009555990 Refactor and improve IntegralConstant
- Add mandatory lossless conversions between instances
- implement `common` properly
2014-11-17 09:13:48 -05:00
Louis Dionne
d042abda97 Automatically test including individual headers. 2014-11-12 11:22:53 -05:00
Louis Dionne
515ade7cf6 Split Fusion adapters. 2014-11-12 11:22:52 -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
647ad436b0 Reorganize the unit tests and increase the overall coverage. 2014-11-04 08:54:58 -05: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
e70e06c831 Add support for std::ratio. 2014-10-20 11:50:43 -04:00
Louis Dionne
b09096c11f Split ext/ integral constants into different files. 2014-10-17 16:31:16 -04:00
Louis Dionne
4ff5485bd3 Remove workarounds for now-fixed libc++ #19616 2014-10-08 19:31:28 -04:00
Louis Dionne
2d10fb461a Use minimal includes in unit tests. 2014-09-01 18:14:55 -04:00
Louis Dionne
26af39f3d9 Flip the arguments of several methods.
Flipped:
- traverse
- fmap, adjust, fill, replace
- drop_while, drop_until
- take_while, take_until
2014-08-29 10:24:19 -04:00
Louis Dionne
919bc2f465 Move for_each to Foldable and optimize it with unpack 2014-08-28 12:53:33 -04:00
Louis Dionne
cbeb6ae983 Core: add the make function 2014-08-25 12:33:49 -04:00
Louis Dionne
be808cca69 Re-add unit tests for Fusion adaptors 2014-08-25 12:33:48 -04:00
Louis Dionne
084fe9582d Re-add MPL vector. 2014-08-18 19:26:29 -04:00
Louis Dionne
307d3d0ec8 Huge reorganization and refactoring.
- Split type class instances into separate files
- Instances provided automatically by a type class are actually MCDs
- Test each instance in a single file, not one file per method
- Refactor the operator system to fix the ADL-related bug.
2014-08-18 19:26:29 -04:00
Louis Dionne
f2de95a841 Use detail::injection instead of a std::tuple in the tests 2014-08-16 14:25:57 -04:00
Louis Dionne
a67c592a1f Fusion: instantiate Searchable 2014-08-10 16:46:09 -04:00
Louis Dionne
1d986e4c04 Refactor the unit tests and examples
In particular, merge some unit tests and examples to reduce compilation
times.
2014-08-10 15:42:03 -04:00
Louis Dionne
356ee03483 Refactor the unit tests and remove some minimal instances 2014-08-09 17:49:16 -04:00
Louis Dionne
da8135ccec Foldable: flip the arguments of some methods 2014-08-05 19:52:44 -04:00
Louis Dionne
b4cfc58e72 Searchable: flip the order of the arguments of the methods 2014-08-05 16:46:56 -04:00
Louis Dionne
f5bc67709e Add master headers for ext/ components 2014-08-05 14:01:46 -04:00
Louis Dionne
f992faa91e Remove std::list adaptor; Iterable requires a Constant is_empty. 2014-08-05 12:14:40 -04:00
Louis Dionne
d132db0ebf Use finer grained assertions acknowledging Constants 2014-08-05 10:37:54 -04:00
Louis Dionne
8c683c6e08 Adapt MPL IntegralConstants with Constant. 2014-07-30 19:00:06 -04:00
Louis Dionne
8a8ff797ab Split Core into subdirectories to reduce dependencies. 2014-07-30 11:15:26 -04:00
Louis Dionne
f66871ec2c MPLVector: Document and instantiate List. 2014-07-29 15:44:45 -04:00
Louis Dionne
61576fc1ae Functor: improve laws and check them widely 2014-07-19 15:08:58 -04:00
Louis Dionne
2eb9867ec5 Comparable: Check laws widely 2014-07-16 17:12:19 -04:00
Louis Dionne
7e8f109d7f Modularize List and add a minimal instance 2014-07-16 16:26:23 -04:00
Louis Dionne
20814674c0 Modularize Monad 2014-07-16 16:26:22 -04:00
Louis Dionne
83bd276b3e Modularize Functor 2014-07-16 16:26:22 -04:00
Louis Dionne
86c0d427a0 StdIntegerSequence: improve the Comparable instance. 2014-07-15 10:05:30 -04:00
Louis Dionne
8a3efe60fe StdTuple: Add note about redundant Applicative instance. 2014-07-14 20:45:14 -04:00
Louis Dionne
3889cbe0b8 ext/boost/fusion: use Boost.Fusion algorithms whenever possible. 2014-07-12 15:15:49 -04:00
Louis Dionne
53a4d872db Adapt boost::tuple. 2014-07-08 11:03:16 -04:00
Louis Dionne
6aa9c3e3c8 Add tests for Fusion tuple. 2014-07-08 10:17:33 -04:00
Louis Dionne
13b330fa41 Move mpl and fusion from ext/ to ext/boost/ 2014-07-08 10:13:02 -04:00
Louis Dionne
eecdf93453 Adapt non-associative ForwardSequences from Boost.Fusion. 2014-07-07 18:17:36 -04:00
Louis Dionne
5a2de2073e Reorganize and rename the adapted/ folder. 2014-07-07 12:42:20 -04:00