Module

Effect.Aff.Compat

Package
purescript-aff
Repository
slamdata/purescript-aff

This module provides compatability functions for constructing Affs which are defined via the FFI.

#EffectFnCb Source

#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

#EffectFn3 Source

data EffectFn3 :: Type -> Type -> Type -> Type -> Type

#EffectFn2 Source

data EffectFn2 :: Type -> Type -> Type -> Type

#EffectFn1 Source

data EffectFn1 :: Type -> Type -> Type

#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