UNPKG
@typed/effects
Version:
latest (6.8.0)
6.8.0
6.7.3
6.7.2
6.7.1
6.7.0
6.6.0
6.5.1
6.5.0
6.4.0
6.3.2
6.3.1
6.3.0
6.2.1
6.2.0
6.1.0
6.0.0
5.2.0
5.1.2
5.1.1
5.1.0
5.0.0
4.0.1
4.0.0
3.1.2
3.1.1
3.1.0
3.0.0
2.2.0
2.1.0
2.0.0
1.4.0
1.3.0
1.2.1
1.2.0
1.1.0
1.0.0
Generator-powered Effect management
github.com/TylorS/typed-prelude
TylorS/typed-prelude
@typed/effects
/
source
/
run
/
startEffect.ts
7 lines
(5 loc)
•
276 B
text/typescript
View Raw
1
2
3
4
5
6
7
import
{
Env
,
Resume
}
from
'@typed/env'
import
{
Capabilities
,
Effect
}
from
'../Effect'
export
const
startEffect = <A
extends
Effect
<
any
,
any
>>(
effect
: A):
Env
<
Capabilities
<A>, A> =>
(
_
:
Capabilities
<A>,
) =>
Resume
.
create
<A>(
(
cb
) =>
cb
(effect[
Symbol
.
iterator
]()
as
A))