Option!T

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 1 10:21:54 PDT 2014


On 07/01/2014 02:35 PM, Sebastian Graf wrote:
>
> Actually, like bearophile pointed out, it's not that Option is a
> range, but that ranges and Option are monads,

Option 'is' a range as much as it 'is'* a monad.

> e.g. mappable and flattenable.

i.e. empty, front, popFront have conforming implementations.

> Being mappable and flattenable is no unique trait of
> ranges,

It is also not everything there is to ranges. OTOH, every range 'is' a 
monad, so saying that Option 'is' a range is more precise than saying 
that it 'is' a monad

> that's where the mixup comes from I think.
> ...

The 'mixup' comes from implementing Option at a suboptimally high level 
of abstraction. More abstraction is unlikely to help here. :o)


* (This is a little sloppy.)


More information about the Digitalmars-d mailing list