As a library-user, I would like typecase to autogenerate predicate functions for variant types. I.e. when using
@variant
class Tree:
Leaf = Tuple(object)
Branch = Tuple(Object, Object)
I want to be able to call
>>> Leaf(4).is_leaf
True
>>> Leaf(4).is_branch
False
By autogenerating such lower-case method names, we would have to map the type names to such method names. Probably, enforcing that ADT type names are pep8 conforming would be good constraint to simplify method name generation.
As a library-user, I would like typecase to autogenerate predicate functions for variant types. I.e. when using
I want to be able to call
By autogenerating such lower-case method names, we would have to map the type names to such method names. Probably, enforcing that ADT type names are pep8 conforming would be good constraint to simplify method name generation.