Module

Effect.Aff.Compat

Package
purescript-aff
Repository
purescript-contrib/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 t0 t1 t2 t3

Instances

#EffectFn2 Source

data EffectFn2 t0 t1 t2

Instances

#EffectFn1 Source

data EffectFn1 t0 t1

Instances

#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