Boost logo

Boost :

Subject: [boost] Boost.Hana - Type Classes, data types and categories (tags).
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-09-16 02:58:50

Hi Louis,

There is a lot of very good work on your library.

I have some comments in relation on how I have implemented Type Classes
in my prototype.

About datatype<T>. The library proposes type classes and data types. The
name datatype_t<> is confusing as the datatype<T> meta-functions must
not return one of the defined data types. I see it much more as a
category, which is used to map the data type to a category used as
parameter of the instantiation


In addition, I wonder if the category associated shouldn't depend on the
type class we want to map.

TC::Instance<category_t<T, TC>>

About naming: Haskell doesn't have namespaces and all the functions are
at the same scope. Your library makes use of a lot of non-member
functions, and so name clashing must be avoided. What about moving all
the non-member functions of the Type Class to a specific namespace? E.g.

   struct Monad { ... };

namespace monad {
     using namespace applicatives;
     ... bind()

The use would need to use the type class namespace explicitly

   auto x = monad::bind(m, f)

or introduce the namespace of the type class

   using namespace monad;
   auto x = bind(m, f);


Boost list run by bdawes at, gregod at, cpdaniel at, john at