-- 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.1.2 -- | 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 Eq Term instance Ord 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 showBERT :: BERT a => a -> Term readBERT :: BERT a => Term -> (Either String a) instance [overlap ok] Binary Term instance [overlap ok] (Ord k, BERT k, BERT v) => BERT (Map k v) instance [overlap ok] (BERT a, BERT b, BERT c, BERT d) => BERT (a, b, c, d) instance [overlap ok] (BERT a, BERT b, BERT c) => BERT (a, b, c) instance [overlap ok] (BERT a, BERT b) => BERT (a, b) instance [overlap ok] BERT a => BERT [a] instance [overlap ok] BERT ByteString instance [overlap ok] BERT String instance [overlap ok] BERT Float instance [overlap ok] BERT Integer instance [overlap ok] BERT Bool instance [overlap ok] BERT Int instance [overlap ok] BERT Term instance [overlap ok] Read Term instance [overlap ok] Show 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 -- | From a lazy bytestring, return a (lazy) list of packets. This is -- convenient for parsing a stream of adjacent packets. (Eg. by using -- some form of getContents to get a ByteString out of -- a data source). packets :: ByteString -> [Packet] instance Show Packet instance Ord Packet instance Eq Packet instance Binary 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 -- | Transport for BERT-RPC client. Creates a transport from a URI, leaving -- flexibility for several underlying transport implementations. The -- current one is over sockets (TCP), with the URI scheme bert, eg: -- bert://localhost:9000 -- -- The TCP transport will create a new connection for every request -- (every block of withTransport), which seems to be what the -- current server implementations expect. It'd be great to have -- persistent connections, however. module Network.BERT.Transport -- | Defines a transport endpoint. Create with fromURI. data Transport -- | Create a transport from the given URI. fromURI :: String -> IO Transport -- | Create a (TCP) transport from the given host and port fromHostPort :: Integral a => String -> a -> IO Transport data TransportM a -- | Execute the given transport monad action in the context of the passed -- transport. withTransport :: Transport -> TransportM a -> IO a -- | Send a term (inside the transport monad) sendt :: Term -> TransportM () -- | Receive a term (inside the transport monad) recvt :: TransportM Term servet :: Transport -> (Transport -> IO ()) -> IO () instance Show Transport instance Eq Transport instance Monad TransportM instance MonadIO TransportM instance MonadState TransportState TransportM -- | BERT-RPC client (http://bert-rpc.org/). This implements the -- client RPC call logic. module Network.BERT.Client -- | Convenience type for call type Call a = IO (Either Error a) -- | 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 -> String -> String -> [a] -> Call b instance Show Error instance Ord Error instance Eq 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 data DispatchResult Success :: Term -> DispatchResult NoSuchModule :: DispatchResult NoSuchFunction :: DispatchResult Undesignated :: String -> DispatchResult -- | Serve from the given transport (forever), handling each request with -- the given dispatch function in a new thread. serve :: Transport -> (String -> String -> [Term] -> IO DispatchResult) -> IO () instance Eq DispatchResult instance Show DispatchResult instance Ord DispatchResult -- | BERT-RPC client (http://bert-rpc.org/). See -- Network.BERT.Transport and Network.BERT.RPC for more -- details. module Network.BERT