midas/task

Types

pub type Effect(a) {
  Done(a)
  Abort(Snag)
  Bundle(
    module: String,
    function: String,
    resume: fn(Result(String, String)) -> Effect(a),
  )
  Follow(uri: String, resume: fn(Result(Uri, Nil)) -> Effect(a))
  Fetch(
    request: Request(BitArray),
    resume: fn(Result(Response(BitArray), FetchError)) ->
      Effect(a),
  )
  Log(message: String, fn(Result(Nil, Nil)) -> Effect(a))
  Zip(
    files: List(#(String, BitArray)),
    resume: fn(Result(BitArray, Nil)) -> Effect(a),
  )
}

Constructors

  • Done(a)
  • Abort(Snag)
  • Bundle(
      module: String,
      function: String,
      resume: fn(Result(String, String)) -> Effect(a),
    )
  • Follow(uri: String, resume: fn(Result(Uri, Nil)) -> Effect(a))
  • Fetch(
      request: Request(BitArray),
      resume: fn(Result(Response(BitArray), FetchError)) -> Effect(a),
    )
  • Log(message: String, fn(Result(Nil, Nil)) -> Effect(a))
  • Zip(
      files: List(#(String, BitArray)),
      resume: fn(Result(BitArray, Nil)) -> Effect(a),
    )
pub type FetchError {
  NetworkError(String)
  UnableToReadBody
  NotImplemented
}

Constructors

  • NetworkError(String)
  • UnableToReadBody
  • NotImplemented

Functions

pub fn abort(value: Snag) -> Effect(a)
pub fn bundle(m: String, f: String) -> Effect(String)
pub fn do(eff: Effect(a), then: fn(a) -> Effect(b)) -> Effect(b)
pub fn done(value: a) -> Effect(a)
pub fn fetch(
  request: Request(BitArray),
) -> Effect(Response(BitArray))
pub fn follow(uri: String) -> Effect(Uri)
pub fn log(message: String) -> Effect(Nil)
pub fn try(
  result: Result(a, Snag),
  then: fn(a) -> Effect(b),
) -> Effect(b)
pub fn zip(
  message: List(#(String, BitArray)),
) -> Effect(BitArray)
Search Document