molecule

io

package io

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

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. io
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
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 process.ProcessType0x0[R] with ProcessType[R]

    Process type with no input or output.

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

    Process type with one output channel of type A

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

    Process type with one input channel of type A

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

    Process type with one input and one output.

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

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

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

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

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

  14. abstract class ProcessType3x1[A, B, C, E, R] extends process.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

  2. object Output

  3. object ProcessType

  4. object Resource

  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.

  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.

  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.

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

    Enrich a result channel.

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

    Enrich a producer channel.

  10. implicit def enrichIOPlatform(p: Platform): RichIOPlatform

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

    Enrich a result channel.

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

    Enrich a return channel.

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

    Implicit conversion to 'enrich' an output of strings.

  14. val getPlatform: IO[Platform]

    Action that gets the current platform.

  15. def getPlatformAs[P <: Platform]: IO[P]

    Action that gets the current platform.

  16. def getRandom: IO[Random]

    Return a Random.

    Return a Random.

    returns

    an action that returns a Random.

  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.

  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.

  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.

  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.

  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.

  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.

  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

  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

  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

  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

  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.

  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.

  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.

  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.

  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.

  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.

  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

  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.

  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.

  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.

  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.

  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.

Inherited from AnyRef

Inherited from Any

Ungrouped