-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Socket utilities. -- -- Binary ingress server, egress client, and bidirectional binarry -- client/server @package om-socket @version 1.0.0.1 -- | Socket utilities. module OM.Socket -- | A description of a socket address on which a socket is or should be -- listening. Supports both IPv4 and IPv6. -- -- Examples: -- --
--   AddressDescription "[::1]:80" -- IPv6 localhost, port 80
--   AddressDescription "127.0.0.1:80" -- IPv4 localhost, port 80
--   AddressDescription "somehost:80" -- IPv4 or IPv6 (depending on what name resolution returns), port 80
--   
newtype AddressDescription AddressDescription :: Text -> AddressDescription [unAddressDescription] :: AddressDescription -> Text -- | Resolve a host:port address into a SockAddr. resolveAddr :: (MonadIO m, MonadFail m) => AddressDescription -> m SockAddr -- | Opens an "ingress" socket, which is a socket that accepts a stream of -- messages without responding. In particular, we listen on a socket, -- accepting new connections, an each connection concurrently reads its -- elements off the socket and pushes them onto the stream. openIngress :: forall i (m :: Type -> Type) never_returns. (Binary i, MonadFail m, MonadIO m, Race) => AddressDescription -> Stream (Of i) m never_returns -- | Open an "egress" socket, which is a socket that sends a stream of -- messages without receiving responses. openEgress :: (Binary o, MonadFail m, MonadIO m) => AddressDescription -> Stream (Of o) m r -> m r -- | Open a "server" socket, which is a socket that accepts incoming -- requests and provides a way to respond to those requests. openServer :: (Binary request, Binary response, MonadLogger m, MonadCatch m, MonadFail m, MonadUnliftIO m, Race) => AddressDescription -> Maybe (IO ServerParams) -> Stream (Of (request, response -> m Responded)) m never_returns -- | Proof that a response function was called on the server. Mainly useful -- for including in a type signature somewhere in your server -- implementation to help ensure that you actually responded to the -- request in all cases. data Responded -- | Connect to a server. Returns a function in MonadIO that can be -- used to submit requests to (and returns the corresponding response -- from) the server. connectServer :: forall n request m response. (Binary request, Binary response, MonadIO m, MonadLoggerIO n, Show response) => AddressDescription -> Maybe ClientParams -> n (request -> m response) instance Data.Binary.Class.Binary OM.Socket.AddressDescription instance Data.Binary.Class.Binary OM.Socket.MessageId instance Data.Binary.Class.Binary p => Data.Binary.Class.Binary (OM.Socket.Request p) instance Data.Binary.Class.Binary p => Data.Binary.Class.Binary (OM.Socket.Response p) instance GHC.Enum.Bounded OM.Socket.MessageId instance GHC.Enum.Enum OM.Socket.MessageId instance GHC.Classes.Eq OM.Socket.AddressDescription instance GHC.Classes.Eq OM.Socket.MessageId instance Data.Aeson.Types.FromJSON.FromJSON OM.Socket.AddressDescription instance Data.Aeson.Types.FromJSON.FromJSONKey OM.Socket.AddressDescription instance GHC.Generics.Generic OM.Socket.AddressDescription instance GHC.Generics.Generic OM.Socket.Endpoint instance GHC.Generics.Generic (OM.Socket.Request p) instance GHC.Generics.Generic (OM.Socket.Response p) instance Data.String.IsString OM.Socket.AddressDescription instance GHC.Base.Monoid OM.Socket.AddressDescription instance GHC.Num.Num OM.Socket.MessageId instance GHC.Classes.Ord OM.Socket.AddressDescription instance GHC.Classes.Ord OM.Socket.MessageId instance GHC.Base.Semigroup OM.Socket.AddressDescription instance GHC.Show.Show OM.Socket.AddressDescription instance GHC.Show.Show OM.Socket.MessageId instance GHC.Show.Show p => GHC.Show.Show (OM.Socket.Request p) instance GHC.Show.Show p => GHC.Show.Show (OM.Socket.Response p) instance Data.Aeson.Types.ToJSON.ToJSON OM.Socket.AddressDescription instance Data.Aeson.Types.ToJSON.ToJSONKey OM.Socket.AddressDescription