Extend TaskOption from Alt1 to Alternative1
pbadenski opened this issue ยท 4 comments
๐ Feature request
Current Behavior
Currently TaskOption implements Alt1.
Desired Behavior
Add zero
to TaskOption to implement Alternative1.
Suggested Solution
const zero = getOptionM(..).none
Who does this impact? Who is this for?
People using Applicative interface.
Your environment
Software | Version(s) |
---|---|
fp-ts | 2.0.1 |
fp-ts-contrib | 0.1.14 |
TypeScript | 3.6 |
What do you think of changing OptionT
first to implement Alternative1
? Then adding zero
via T.zero
(where T = getOptionM(task)
)?
@pbadenski what do you mean? Isn't zero = T.none
?
Sorry, I haven't really explained this well.
At the moment taskOption has:
map: T.map,
ap: T.ap,
chain: T.chain,
alt: T.alt,
To add zero to the above list in taskOption we could do two things.
- Add
zero = T.none
. - Or add
zero
toOptionT
first and then in TaskOption havezero = T.zero
.
Option already has both none
and zero
. In 2. option there would be then full symmetry between Option, OptionT & TaskOption.
I suppose, now that I think about it - starting with 1. is probably better for backwards compatibility and rolling this change out.
starting with 1. is probably better for backwards compatibility and rolling this change out
๐