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 eff a. 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 :: # Effect -> Type -> Type -> Type -> Type -> Type

#EffFn2 Source

data EffFn2 :: # Effect -> Type -> Type -> Type -> Type

#EffFn1 Source

data EffFn1 :: # Effect -> Type -> Type -> Type

#runEffFn3 Source

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

#runEffFn2 Source

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

#runEffFn1 Source

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

#mkEffFn3 Source

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

#mkEffFn2 Source

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

#mkEffFn1 Source

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