Module
Effect.Aff.Compat
- Package
- purescript-aff
- Repository
- slamdata/purescript-aff
This module provides compatability functions for constructing Aff
s which
are defined via the FFI.
#EffectFnAff Source
newtype EffectFnAff a
Constructors
#EffectFnCanceler Source
newtype EffectFnCanceler
Constructors
#EffectFnCb Source
type EffectFnCb a = EffectFn1 a Unit
#fromEffectFnAff Source
fromEffectFnAff :: EffectFnAff ~> Aff
Lift a FFI definition into an Aff
. EffectFnAff
makes use of EffectFn
so
Effect
thunks are unnecessary. A definition might follow this example:
exports._myAff = function (onError, onSuccess) {
var cancel = doSomethingAsync(function (err, res) {
if (err) {
onError(err);
} else {
onSuccess(res);
}
});
return function (cancelError, onCancelerError, onCancelerSuccess) {
cancel();
onCancelerSuccess();
};
};
foreign import _myAff :: EffectFnAff String
myAff :: Aff String
myAff = fromEffectFnAff _myAff
Re-exports from Effect.Uncurried
#runEffectFn3 Source
runEffectFn3 :: forall r c b a. EffectFn3 a b c r -> a -> b -> c -> Effect r
#runEffectFn2 Source
runEffectFn2 :: forall r b a. EffectFn2 a b r -> a -> b -> Effect r
#runEffectFn1 Source
runEffectFn1 :: forall r a. EffectFn1 a r -> a -> Effect r
#mkEffectFn3 Source
mkEffectFn3 :: forall r c b a. (a -> b -> c -> Effect r) -> EffectFn3 a b c r
#mkEffectFn2 Source
mkEffectFn2 :: forall r b a. (a -> b -> Effect r) -> EffectFn2 a b r
#mkEffectFn1 Source
mkEffectFn1 :: forall r a. (a -> Effect r) -> EffectFn1 a r