Skip to content

Default "isinstance" type predicate functions / properties #8

@HolgerPeters

Description

@HolgerPeters

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions