Module

Control.Monad.Aff.Compat

Package
purescript-aff
Repository
slamdata/purescript-aff

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

#EffFnAff Source

newtype EffFnAff eff a

Constructors

#EffFnCanceler Source

newtype EffFnCanceler eff

Constructors

#EffFnCb Source

type EffFnCb eff a = EffFn1 eff a Unit

#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

Re-exports from Control.Monad.Eff.Uncurried

#EffFn3 Source

data EffFn3 :: Row Effect -> Type -> Type -> Type -> Type -> Type

#EffFn2 Source

data EffFn2 :: Row Effect -> Type -> Type -> Type -> Type

#EffFn1 Source

data EffFn1 :: Row Effect -> Type -> Type -> Type

#runEffFn3 Source

runEffFn3 :: forall r c b a eff. EffFn3 eff a b c r -> a -> b -> c -> Eff eff r

#runEffFn2 Source

runEffFn2 :: forall r b a eff. EffFn2 eff a b r -> a -> b -> Eff eff r

#runEffFn1 Source

runEffFn1 :: forall r a eff. EffFn1 eff a r -> a -> Eff eff r

#mkEffFn3 Source

mkEffFn3 :: forall r c b a eff. (a -> b -> c -> Eff eff r) -> EffFn3 eff a b c r

#mkEffFn2 Source

mkEffFn2 :: forall r b a eff. (a -> b -> Eff eff r) -> EffFn2 eff a b r

#mkEffFn1 Source

mkEffFn1 :: forall r a eff. (a -> Eff eff r) -> EffFn1 eff a r