midas/task

Types

pub type Effect(a) {
  Done(a)
  Abort(Snag)
  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)
  • 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 do(eff: Effect(a), then: fn(a) -> Effect(b)) -> Effect(b)
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