Module
Effect.Aff.Compat
- Package
- purescript-aff
- Repository
- purescript-contrib/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 a b c r. EffectFn3 a b c r -> a -> b -> c -> Effect r
#runEffectFn2 Source
runEffectFn2 :: forall a b r. EffectFn2 a b r -> a -> b -> Effect r
#runEffectFn1 Source
runEffectFn1 :: forall a r. EffectFn1 a r -> a -> Effect r
#mkEffectFn3 Source
mkEffectFn3 :: forall a b c r. (a -> b -> c -> Effect r) -> EffectFn3 a b c r
#mkEffectFn2 Source
mkEffectFn2 :: forall a b r. (a -> b -> Effect r) -> EffectFn2 a b r
#mkEffectFn1 Source
mkEffectFn1 :: forall a r. (a -> Effect r) -> EffectFn1 a r