Aiui the most salient feature of your new type is being syntax sugar
for conveniently creating and naming a sum type that includes `Failure`,
i.e. instead of:

    my $foo where Int | Failure;
    $foo = 42;
    $foo = Failure;
    $foo = 'nope'; # Type check failed in assignment to $foo; expected
<anon> but got Str ("s")

One can write and get something like:

    my FailureOr[Int] $foo;
    $foo = 42;
    $foo = Failure;
    $foo = 'nope'; # Type check failed in assignment to $foo; expected
Failure or Int but got Str ("s")

If I'm right then imo it's not at all important that it uses the MOP.
If it isn't a general sum type then perhaps just FailureOr or Tyoe::FailureOr.
If it's a general sum type then perhaps Type::Sum.




On Mon, Apr 8, 2019 at 6:38 PM Ben Davies <kai...@outlook.com> wrote:
>
> I wrote a small sum type module that subclasses
> Perl6::Metamodel::SubsetHOW. I was thinking of naming it either
> Type::Sum or Metamodel::SumHOW, but Type::Sum doesn't follow the style
> Rakudo uses for naming MOP classes, and Metamodel::SumHOW may not be a
> good name because it'd leak the module into CORE. What should I call it?
>

Reply via email to