Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
TCP Boxes.
Synopsis
- data TCPConfig = TCPConfig {
- hostPreference :: HostPreference
- host :: Text
- port :: Text
- chunk :: Int
- endLine :: Text
- defaultTCPConfig :: TCPConfig
- data TCPEnv = TCPEnv {}
- data Socket
- connect :: TCPConfig -> Codensity IO TCPEnv
- serve :: TCPConfig -> Codensity IO TCPEnv
- receiver :: TCPConfig -> Committer IO ByteString -> Socket -> IO ()
- sender :: Emitter IO ByteString -> Socket -> IO SocketStatus
- duplex :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> Socket -> IO ()
- clientBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO ()
- clientCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString
- serverBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO ()
- serverCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString
- responseServer :: TCPConfig -> (ByteString -> Maybe ByteString) -> IO ()
Documentation
TCP configuration
>>>
defaultTCPConfig
TCPConfig {hostPreference = HostAny, host = "127.0.0.1", port = "3566", chunk = 2048, endLine = "\n"}
Instances
Generic TCPConfig Source # | |
Show TCPConfig Source # | |
Eq TCPConfig Source # | |
type Rep TCPConfig Source # | |
Defined in Box.TCP type Rep TCPConfig = D1 ('MetaData "TCPConfig" "Box.TCP" "box-socket-0.5.1.0-HZSvScoEvBQ2CZcs9ZHRQi" 'False) (C1 ('MetaCons "TCPConfig" 'PrefixI 'True) ((S1 ('MetaSel ('Just "hostPreference") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HostPreference) :*: S1 ('MetaSel ('Just "host") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "port") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "chunk") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "endLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))) |
defaultTCPConfig :: TCPConfig Source #
default
Basic type for a socket.
receiver :: TCPConfig -> Committer IO ByteString -> Socket -> IO () Source #
Commit received ByteStrings.
sender :: Emitter IO ByteString -> Socket -> IO SocketStatus Source #
Send emitted ByteStrings.
duplex :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> Socket -> IO () Source #
A two-way connection.
clientBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO () Source #
A Box
action for a client.
clientCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString Source #
A client CoBox
.
serverBox :: TCPConfig -> PostSend -> Box IO ByteString ByteString -> IO () Source #
A Box
action for a server.
serverCoBox :: TCPConfig -> PostSend -> CoBox IO ByteString ByteString Source #
A server CoBox
.
responseServer :: TCPConfig -> (ByteString -> Maybe ByteString) -> IO () Source #
A receiver that applies a response function to received ByteStrings.