hosc-0.15: Haskell Open Sound Control

Safe Haskell | None
Language | Haskell98

Sound.OSC.Transport.Monad

Contents

- Send
- Receive
- Wait

Description

Monad class implementing an Open Sound Control transport.

Synopsis

- class Monad m => SendOSC m where
- class Monad m => RecvOSC m where
- class (SendOSC m, RecvOSC m) => DuplexOSC m
- class (DuplexOSC m, MonadIO m) => Transport m
- type Connection t a = ReaderT t IO a
- withTransport :: Transport t => IO t -> Connection t a -> IO a
- sendMessage :: SendOSC m => Message -> m ()
- sendBundle :: SendOSC m => Bundle -> m ()
- recvOSC :: (RecvOSC m, OSC o) => m (Maybe o)
- recvBundle :: RecvOSC m => m Bundle
- recvMessage :: RecvOSC m => m (Maybe Message)
- recvMessages :: RecvOSC m => m [Message]
- waitUntil :: RecvOSC m => (Packet -> Bool) -> m Packet
- waitFor :: RecvOSC m => (Packet -> Maybe a) -> m a
- waitImmediate :: RecvOSC m => m Packet
- waitMessage :: RecvOSC m => m Message
- waitAddress :: RecvOSC m => Address_Pattern -> m Packet
- waitReply :: RecvOSC m => Address_Pattern -> m Message
- waitDatum :: RecvOSC m => Address_Pattern -> m [Datum]

# Documentation

class Monad m => SendOSC m where Source #

Sender monad.

Minimal complete definition

sendOSC

Methods

sendOSC :: OSC o => o -> m () Source #

Encode and send an OSC packet.

Instances

(Transport t, MonadIO io) => SendOSC (ReaderT * t io) Source # |
Methods sendOSC :: OSC o => o -> ReaderT * t io () Source #

class Monad m => RecvOSC m where Source #

Receiver monad.

Minimal complete definition

recvPacket

Methods

recvPacket :: m Packet Source #

Receive and decode an OSC packet.

Instances

(Transport t, MonadIO io) => RecvOSC (ReaderT * t io) Source # |
Methods recvPacket :: ReaderT * t io Packet Source #

class (SendOSC m, RecvOSC m) => DuplexOSC m Source #

`DuplexOSC` is the union of `SendOSC` and `RecvOSC`.

Instances

(Transport t, MonadIO io) => DuplexOSC (ReaderT * t io) Source # |

class (DuplexOSC m, MonadIO m) => Transport m Source #

`Transport` is `DuplexOSC` with a `MonadIO` constraint.

Instances

(Transport t, MonadIO io) => Transport (ReaderT * t io) Source # |

type Connection t a = ReaderT t IO a Source #

Transport connection.

withTransport :: Transport t => IO t -> Connection t a -> IO a Source #

Bracket Open Sound Control communication.

# Send

sendMessage :: SendOSC m => Message -> m () Source #

Type restricted synonym for `sendOSC`.

sendBundle :: SendOSC m => Bundle -> m () Source #

Type restricted synonym for `sendOSC`.

# Receive

recvOSC :: (RecvOSC m, OSC o) => m (Maybe o) Source #

Variant of `recvPacket` that runs `fromPacket`.

recvBundle :: RecvOSC m => m Bundle Source #

Variant of `recvPacket` that runs `packet_to_bundle`.

recvMessage :: RecvOSC m => m (Maybe Message) Source #

Variant of `recvPacket` that runs `packet_to_message`.

recvMessages :: RecvOSC m => m [Message] Source #

Variant of `recvPacket` that runs `packetMessages`.

# Wait

waitUntil :: RecvOSC m => (Packet -> Bool) -> m Packet Source #

Wait for a `Packet` where the supplied predicate is `True`, discarding intervening packets.

waitFor :: RecvOSC m => (Packet -> Maybe a) -> m a Source #

Wait for a `Packet` where the supplied function does not give `Nothing`, discarding intervening packets.

waitImmediate :: RecvOSC m => m Packet Source #

`waitUntil` `packet_is_immediate`.

waitMessage :: RecvOSC m => m Message Source #

`waitFor` `packet_to_message`, ie. an incoming `Message` or immediate mode `Bundle` with one element.

waitAddress :: RecvOSC m => Address_Pattern -> m Packet Source #

A `waitFor` for variant using `packet_has_address` to match on the `Address_Pattern` of incoming `Packets`.

waitReply :: RecvOSC m => Address_Pattern -> m Message Source #

Variant on `waitAddress` that returns matching `Message`.

waitDatum :: RecvOSC m => Address_Pattern -> m [Datum] Source #

Variant of `waitReply` that runs `messageDatum`.