-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | BERT implementation
--
-- Implements the BERT serialization and RPC protocols described at
-- http://bert-rpc.org/.
@package bert
@version 1.2.2.5
-- | The Term type.
module Data.BERT.Types
-- | A single BERT term.
data Term
IntTerm :: Int -> Term
FloatTerm :: Float -> Term
AtomTerm :: String -> Term
TupleTerm :: [Term] -> Term
BytelistTerm :: ByteString -> Term
ListTerm :: [Term] -> Term
BinaryTerm :: ByteString -> Term
BigintTerm :: Integer -> Term
BigbigintTerm :: Integer -> Term
NilTerm :: Term
BoolTerm :: Bool -> Term
DictionaryTerm :: [(Term, Term)] -> Term
TimeTerm :: UTCTime -> Term
RegexTerm :: String -> [String] -> Term
instance GHC.Read.Read Data.BERT.Types.Term
instance GHC.Show.Show Data.BERT.Types.Term
instance GHC.Classes.Ord Data.BERT.Types.Term
instance GHC.Classes.Eq Data.BERT.Types.Term
-- | Parse (simple) BERTs.
module Data.BERT.Parser
-- | Parse a simple BERT (erlang) term from a string in the erlang grammar.
-- Does not attempt to decompose complex terms.
parseTerm :: String -> Either ParseError Term
-- | Define BERT terms their binary encoding & decoding and a typeclass
-- for converting Haskell values to BERT terms and back.
--
-- We define a number of convenient instances for BERT. Users will
-- probably want to define their own instances for composite types.
module Data.BERT.Term
class BERT a
-- | Introduce a Term from a Haskell value.
showBERT :: BERT a => a -> Term
-- | Attempt to read a haskell value from a Term.
readBERT :: BERT a => Term -> (Either String a)
showTerm :: Term -> String
-- | Parse a simple BERT (erlang) term from a string in the erlang grammar.
-- Does not attempt to decompose complex terms.
parseTerm :: String -> Either ParseError Term
instance Data.BERT.Term.BERT Data.BERT.Types.Term
instance Data.BERT.Term.BERT GHC.Types.Int
instance Data.BERT.Term.BERT GHC.Types.Bool
instance Data.BERT.Term.BERT GHC.Integer.Type.Integer
instance Data.BERT.Term.BERT GHC.Types.Float
instance Data.BERT.Term.BERT GHC.Base.String
instance Data.BERT.Term.BERT Data.ByteString.Lazy.Internal.ByteString
instance Data.BERT.Term.BERT a => Data.BERT.Term.BERT [a]
instance (Data.BERT.Term.BERT a, Data.BERT.Term.BERT b) => Data.BERT.Term.BERT (a, b)
instance (Data.BERT.Term.BERT a, Data.BERT.Term.BERT b, Data.BERT.Term.BERT c) => Data.BERT.Term.BERT (a, b, c)
instance (Data.BERT.Term.BERT a, Data.BERT.Term.BERT b, Data.BERT.Term.BERT c, Data.BERT.Term.BERT d) => Data.BERT.Term.BERT (a, b, c, d)
instance (GHC.Classes.Ord k, Data.BERT.Term.BERT k, Data.BERT.Term.BERT v) => Data.BERT.Term.BERT (Data.Map.Base.Map k v)
instance Data.Binary.Class.Binary Data.BERT.Types.Term
-- | BERP (BERT packets) support.
module Data.BERT.Packet
-- | A single BERP. Little more than a wrapper for a term.
data Packet
Packet :: Term -> Packet
fromPacket :: Packet -> Term
instance GHC.Classes.Eq Data.BERT.Packet.Packet
instance GHC.Classes.Ord Data.BERT.Packet.Packet
instance GHC.Show.Show Data.BERT.Packet.Packet
instance Data.Binary.Class.Binary Data.BERT.Packet.Packet
-- | BERT (Erlang terms) implementation. See http://bert-rpc.org/
-- and http://erlang.org/doc/apps/erts/erl_ext_dist.html for more
-- details.
module Data.BERT
-- | Underlying transport abstraction
module Network.BERT.Transport
-- | The class for transports
class Transport t
runSession :: Transport t => t -> TransportM a -> IO a
closeConnection :: Transport t => t -> IO ()
class Transport (ServerTransport s) => Server s where type family ServerTransport s
-- | This method should listen for incoming requests, establish some sort
-- of a connection (represented by the transport) and then invoke the
-- handling function
runServer :: Server s => s -> (ServerTransport s -> IO ()) -> IO ()
-- | Free any resources that the server has acquired (such as the listening
-- socket)
cleanup :: Server s => s -> IO ()
-- | The transport monad allows receiving packets through the conduit, and
-- sending functions via the provided SendPacketFn
type TransportM = ReaderT SendPacketFn (ConduitM Packet Void IO)
-- | A function to send packets to the peer
type SendPacketFn = Packet -> IO ()
-- | Send a term
sendt :: Term -> TransportM ()
-- | Receive a term
recvt :: TransportM (Maybe Term)
-- | Execute an action for every incoming term, until the connection is
-- closed
recvtForever :: (Term -> TransportM a) -> TransportM ()
-- | The TCP transport
data TCP
TCP :: !Socket -> TCP
-- | The socket used for communication.
--
-- The connection is assumed to be already established when this
-- structure is passed in.
[getTcpSocket] :: TCP -> !Socket
-- | Establish a connection to the TCP server and return the resulting
-- transport. It can be used to make multiple requests.
tcpClient :: HostName -> PortNumber -> IO TCP
-- | The TCP server
data TCPServer
TCPServer :: !Socket -> TCPServer
-- | The listening socket. Assumed to be bound but not listening yet.
[getTcpListenSocket] :: TCPServer -> !Socket
-- | A simple TCPServer constructor, listens on all local
-- interfaces.
--
-- If you want to bind only to some of the interfaces, create the socket
-- manually using the functions from Network.Socket.
tcpServer :: PortNumber -> IO TCPServer
-- | A simple address resolver
resolve :: HostName -> IO HostAddress
instance Network.BERT.Transport.Transport Network.BERT.Transport.TCP
instance Network.BERT.Transport.Server Network.BERT.Transport.TCPServer
-- | BERT-RPC client (http://bert-rpc.org/). This implements the
-- client RPC call logic.
module Network.BERT.Client
-- | Call the {mod, func, args} synchronously on the endpoint
-- defined by transport, returning the results of the call or an
-- error.
call :: (BERT a, BERT b, Transport t) => t -> String -> String -> [a] -> Call b
-- | Establish a connection to the TCP server and return the resulting
-- transport. It can be used to make multiple requests.
tcpClient :: HostName -> PortNumber -> IO TCP
-- | Convenience type for call
type Call a = IO (Either Error a)
data Error
ClientError :: String -> Error
ServerError :: Term -> Error
instance GHC.Classes.Eq Network.BERT.Client.Error
instance GHC.Classes.Ord Network.BERT.Client.Error
instance GHC.Show.Show Network.BERT.Client.Error
-- | BERT-RPC server (http://bert-rpc.org/). This implements the
-- client RPC call/reply logic. Only synchronous requests are supported
-- at this time.
module Network.BERT.Server
-- | Serve from the given transport (forever), handling each request with
-- the given dispatch function in a new thread.
serve :: Server s => s -> (String -> String -> [Term] -> IO DispatchResult) -> IO ()
data DispatchResult
Success :: Term -> DispatchResult
NoSuchModule :: DispatchResult
NoSuchFunction :: DispatchResult
Undesignated :: String -> DispatchResult
-- | A simple TCPServer constructor, listens on all local
-- interfaces.
--
-- If you want to bind only to some of the interfaces, create the socket
-- manually using the functions from Network.Socket.
tcpServer :: PortNumber -> IO TCPServer
instance GHC.Classes.Ord Network.BERT.Server.DispatchResult
instance GHC.Show.Show Network.BERT.Server.DispatchResult
instance GHC.Classes.Eq Network.BERT.Server.DispatchResult
-- | BERT-RPC client (http://bert-rpc.org/). See
-- Network.BERT.Client and Network.BERT.Server for more
-- details.
module Network.BERT