Opaque result types

Having a function with a result type that looks like this:

LazyMapSequence<
  LazyFilterSequence<
    LazyMapSequence<Elements, ElementOfResult?>
  >,
  ElementOfResult
>

is not helping anyone reason about the code. It is flooding them with irrelevant details. Better to say "it's a Collection whose Element type is ElementOfResult".

There really isn't any interesting inference here. The return statement can spell out the type explicitly, or leave it inferred, but callers are unaffected either way.

Personally, I don't consider multiple opaque types to be important enough to base other design decisions on it. It's left as a discussion (not a specific part of the proposal) because I suspect it would become more of an anti-pattern.

Maybe, but having a name that's used in the declaration but not available elsewhere is also confusing. Frankly, I wouldn't want the name in the declaration (e.g., in the generated interface or documentation) unless clients can use the name.

The motivation is two-fold: don't have to write these complicated composed types, and can hide them from clients. @gregtitus made a good argument that the former is the more important motivation, and I tend to agree.

Doug