matovitch:

I am curious to know how isInputRange is implemented since I
wanted to do kind of the same but I am afraid it's full of (ugly)
traits and template trickeries where haskell type classes are
quite neat and essentially a declaration of an interface.

Take a look at the sources and learn. They are sometimes tricky to get right, but it's not a problem of ugly syntax.


I wondered if you could check statically that the type could
implement an interface *if it wanted to* that is, without
inheriting it...

Template constraints don't require inheritance.

Bye,
bearophile

Reply via email to