Module
Control.Monad.Aff.Compat
- Package
- purescript-aff
- Repository
- slamdata/purescript-aff
This module provides compatability functions for constructing Aff
s which
are defined via the FFI.
#EffFnCanceler Source
newtype EffFnCanceler eff
Constructors
#fromEffFnAff Source
fromEffFnAff :: forall a eff. EffFnAff eff a -> Aff eff a
Lift a FFI definition into an Aff
. EffFnAff
makes use of EffFn
so
Eff
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 :: forall eff. EffFnAff (myeffect :: MYEFFECT | eff) String
myAff :: forall eff. Aff (myeffect :: MYEFFECT | eff) String
myAff = fromEffFnAff _myAff