molecule

io

package io

This package offers monadic process types and various combinators for monadic actions (see value members below).

Visibility
  1. Public
  2. All

Type Members

  1. final class IO[+A] extends AnyRef

    The Molecule IO Monad

  2. abstract class Input[+A] extends WInput[A] with SInput[A] with RInput[A]

    A process-level input channel.

  3. abstract class Output[-A] extends Flushable

    A process-level output channel.

  4. trait ProcessType[R] extends AnyRef

    The base trait for all process types.

  5. abstract class ProcessType0x0[R] extends ProcessType0x0[R] with ProcessType[R]

    Process type with no input or output.

  6. abstract class ProcessType0x1[A, R] extends ProcessType0x1[A, R] with ProcessType[R]

    Process type with one output channel of type A

  7. abstract class ProcessType1x0[A, R] extends ProcessType1x0[A, R] with ProcessType[R]

    Process type with one input channel of type A

  8. abstract class ProcessType1x1[A, B, R] extends ProcessType1x1[A, B, R] with ProcessType[R]

    Process type with one input and one output.

  9. abstract class ProcessType1x2[A, E, F, R] extends ProcessType1x2[A, E, F, R] with ProcessType[R]

  10. abstract class ProcessType2x0[A, B, R] extends ProcessType2x0[A, B, R] with ProcessType[R]

  11. abstract class ProcessType2x1[A, B, E, R] extends ProcessType2x1[A, B, E, R] with ProcessType[R]

  12. abstract class ProcessType2x2[A, B, E, F, R] extends ProcessType2x2[A, B, E, F, R] with ProcessType[R]

  13. abstract class ProcessType3x0[A, B, C, R] extends ProcessType3x0[A, B, C, R] with ProcessType[R]

  14. abstract class ProcessType3x1[A, B, C, E, R] extends ProcessType3x1[A, B, C, E, R] with ProcessType[R]

  15. trait RInput[+A] extends AnyRef

    A process-level input channel that can be released.

  16. trait Resource extends AnyRef

    Type of the objects that are automatically shutdown when a process terminates.

  17. class RichIOIORIChan[A] extends AnyRef

    Enrich a result channel returned within an IO with additional methods.

  18. class RichIOPlatform extends AnyRef

    Enrich a Platftorm with additional methods.

  19. class RichIOProducer[A] extends AnyRef

    Enrich a native producer channel.

  20. class RichIORIChan[A] extends AnyRef

    Enrich a result channel with additional methods.

  21. class RichIOROChan[A] extends AnyRef

    Enrich a return channel with additional methods.

  22. class RichIOStringOutput extends AnyRef

    Enrich an output of strings.

  23. trait SInput[+A] extends WInput[A]

    Process-level streaming input channel interface.

  24. trait SysIO extends Executor

    Trait used to wraps task submitted to an external executor inside monadic or streaming I/O.

  25. abstract class WInput[+A] extends AnyRef

    Input that produces one value at a time which may result from selecting on multiple inputs.

Value Members

  1. object IO extends AnyRef

  2. object Output extends AnyRef

  3. object ProcessType extends AnyRef

  4. object Resource extends AnyRef

  5. def attach[T <: Resource](resource: T): IO[T]

    Attach a resource to the resource control of this process such that it gets automatically closed once the process exits.

    Attach a resource to the resource control of this process such that it gets automatically closed once the process exits.

    resource

    a resource.

    returns

    an action that returns the attached resource.

    Definition Classes
    package
  6. def callcc[A](call: ((A) ⇒ IO[Nothing]) ⇒ IO[Nothing]): IO[A]

    Call with current continuation.

    Call with current continuation.

    call

    a function that takes the current continuation as argument.

    returns

    an action that returns the parameter passed to call.

    Definition Classes
    package
  7. def detach[T <: Resource](resource: T): IO[T]

    Detach a resource from the resource control of this process.

    Detach a resource from the resource control of this process.

    resource

    a resource.

    returns

    an action that returns the attached resource.

    Definition Classes
    package
  8. implicit final def enrichIOIORIChan[A](rc: IO[RIChan[A]])(implicit arg0: Message[A]): RichIOIORIChan[A]

    Enrich a result channel.

    Enrich a result channel.

    Definition Classes
    package
  9. implicit final def enrichIONativeProducer[A](pc: NativeProducer[A]): RichIOProducer[A]

    Enrich a producer channel.

    Enrich a producer channel.

    Definition Classes
    package
  10. implicit def enrichIOPlatform(p: Platform): RichIOPlatform

    Definition Classes
    package
  11. implicit final def enrichIORIChan[A](rc: RIChan[A])(implicit arg0: Message[A]): RichIORIChan[A]

    Enrich a result channel.

    Enrich a result channel.

    Definition Classes
    package
  12. implicit final def enrichIOROChan[A](rc: ROChan[A]): RichIOROChan[A]

    Enrich a return channel.

    Enrich a return channel.

    Definition Classes
    package
  13. implicit def enrichIOStringOutput(out: Output[String]): RichIOStringOutput

    Implicit conversion to 'enrich' an output of strings.

    Implicit conversion to 'enrich' an output of strings.

    Definition Classes
    package
  14. val getPlatform: IO[Platform]

    Action that gets the current platform.

    Action that gets the current platform.

    Definition Classes
    package
  15. def getPlatformAs[P <: Platform]: IO[P]

    Action that gets the current platform.

    Action that gets the current platform.

    Definition Classes
    package
  16. def getRandom: IO[Random]

    Return a Random.

    Return a Random.

    returns

    an action that returns a Random.

    Definition Classes
    package
  17. def guard(b: Boolean)(io: ⇒ IO[Unit]): IO[Unit]

    Execute a an action if the guard is true.

    Execute a an action if the guard is true.

    b

    the guard.

    io

    the action to execute if b is true.

    returns

    a unit action.

    Definition Classes
    package
  18. def ioLog(msg: String): IO[Unit]

    Action that logs a message.

    Action that logs a message.

    msg

    the message to log.

    returns

    an action that logs a message.

    Definition Classes
    package
  19. def ioLogDbg(msg: String): IO[Unit]

    Action that logs a debug message.

    Action that logs a debug message.

    msg

    the message to log.

    returns

    an action that logs a debug message.

    Definition Classes
    package
  20. def ioLogErr(msg: String): IO[Unit]

    Action that logs an error message.

    Action that logs an error message.

    msg

    the message to log.

    returns

    an action that logs a error message.

    Definition Classes
    package
  21. def ioLogWarn(msg: String): IO[Unit]

    Action that logs a warning message.

    Action that logs a warning message.

    msg

    the message to log.

    returns

    an action that logs a warning message.

    Definition Classes
    package
  22. def join[R](rchan: RIChan[R])(implicit arg0: Message[R]): IO[R]

    Wait for the termination of a process and return its result.

    Wait for the termination of a process and return its result.

    rchan

    the result channel.

    Definition Classes
    package
  23. def launch[R](process: IO[Process[R]], rc: ROChan[R])(implicit arg0: Message[R]): IO[Unit]

    Launch a process

    Launch a process

    process

    an action that returns a process.

    returns

    the result channel

    Definition Classes
    package
  24. def launch[R](process: IO[Process[R]])(implicit arg0: Message[R]): IO[RIChan[R]]

    Launch a process

    Launch a process

    process

    an action that returns a process.

    returns

    the result channel

    Definition Classes
    package
  25. def launch[R](process: Process[R], rc: ROChan[R])(implicit arg0: Message[R]): IO[Unit]

    Launch a process

    Launch a process

    process

    a a process that returns a result of type R.

    rc

    the return channel

    returns

    unit

    Definition Classes
    package
  26. def launch[R](process: Process[R])(implicit arg0: Message[R]): IO[RIChan[R]]

    Launch a process

    Launch a process

    process

    a a process that returns a result of type R.

    returns

    the result channel

    Definition Classes
    package
  27. def managed[A](io: IO[A]): IO[A]

    Close all the resources acquired by the action passed as argument once it terminates.

    Close all the resources acquired by the action passed as argument once it terminates.

    io

    the action to manage.

    Definition Classes
    package
  28. def parl[A, That](ios: Iterable[IO[A]])(implicit ma: Message[A], bf: CanBuildFrom[Nothing, A, That]): IO[That]

    Execute a list of interleaved actions and return their results as a list.

    Execute a list of interleaved actions and return their results as a list. If one action fails all the other actions are terminated and a single signal corresponding to the exception is raised.

    ios

    a list of actions.

    returns

    the list of results. Results occur in the same as the order as the actions that produced them.

    Definition Classes
    package
  29. def parl_[A](ios: Iterable[IO[A]])(implicit arg0: Message[A]): IO[Unit]

    Execute a list of interleaved actions and return when they have all terminated.

    Execute a list of interleaved actions and return when they have all terminated. Contrarily to parl, this action discards the intermediate results.

    ios

    the list of actions.

    returns

    a unit action that returns after all the actions have terminated.

    Definition Classes
    package
  30. def parle[A, That](ios: Iterable[IO[A]])(implicit ma: Message[A], bf: CanBuildFrom[Nothing, Either[Signal, A], That]): IO[That]

    Execute a list of interleaved actions and return their results as a list.

    Execute a list of interleaved actions and return their results as a list.

    ios

    a list of actions.

    returns

    the list of results. Results occur in the same as the order as the actions that produced them.

    Definition Classes
    package
  31. def raise(signal: Signal): IO[Nothing]

    Raise a signal as a user-level exception.

    Raise a signal as a user-level exception.

    signal

    the signal to raise.

    returns

    nothing.

    Definition Classes
    package
  32. def readWithin[A](in: Input[A], time: Int, unit: TimeUnit): IO[Option[A]]

    Read a value on an input within a specified timeout.

    Read a value on an input within a specified timeout.

    in

    the input on which to read a value from

    time

    the timeout

    unit

    the time unit of the delay parameter.

    returns

    Some value if it can be read within the specified timeout, else none.

    Definition Classes
    package
  33. def resetCtx(): IO[Unit]

    Close all the resources acquired in the current context.

    Close all the resources acquired in the current context. Efficient loops with resource control can be written in terms of manage and resetCtx e.g. def forever(io:IO[Unit]):IO[Unit] = { def loop:IO[Unit] = io >> resetCtx() >> managedLoop manage(loop) }

    returns

    the unit action

    Definition Classes
    package
  34. def sleep(timeout: Long, unit: TimeUnit = TimeUnit.MILLISECONDS): IO[Unit]

    Suspend this process for a certain duration (non-blocking).

    Suspend this process for a certain duration (non-blocking).

    timeout

    the duration of sleep.

    unit

    the time unit.

    returns

    a unit action that returns after the sleep period.

    Definition Classes
    package
  35. def spawn[A](a: IO[A])(implicit arg0: Message[A]): IO[RIChan[A]]

    Fork an interleaved action.

    Fork an interleaved action.

    a

    the action.

    returns

    A result channel carrying the result of the action.

    Definition Classes
    package
  36. def unless(b: Boolean)(io: ⇒ IO[Unit]): IO[Unit]

    Execute a an action unless the guard is true.

    Execute a an action unless the guard is true.

    b

    the guard.

    io

    the action to execute if b is false.

    returns

    a unit action.

    Definition Classes
    package
  37. def use[A](ochan: OChan[A])(implicit arg0: Message[A]): IO[Output[A]]

    Use an output channel in the context of the process.

    Use an output channel in the context of the process. The returned process-level output is attached as a resource to the process context, and will get closed automatically when the process terminates, unless the input is explicitly released before (see API of Output[A]).

    ochan

    a first-class output channel.

    returns

    an action that returns the process-level channel.

    Definition Classes
    package
  38. def use[A](ichan: IChan[A])(implicit arg0: Message[A]): IO[Input[A]]

    Use an input channel in the context of the process.

    Use an input channel in the context of the process. The returned process-level input is attached as a resource to the process context, and will get poisoned automatically when the process terminates, unless the input is explicitly released before (see API of Input[A]).

    ichan

    a first-class input channel.

    returns

    an action that returns the process-level channel.

    Definition Classes
    package