Portability | portable |
---|---|
Stability | alpha |
Maintainer | Eric Sessoms <nubgames@gmail.com> |
Speaks the Erlang network protocol and impersonates an Erlang node on the network. Fully capable of bi-directional communication with Erlang. Erlang types are, as far as reasonable, mapped to Haskell types. Messages to Erlang are just function calls in Haskell, and messages from Erlang are delivered to MVars.
- epmdGetNames :: IO [String]
- epmdGetPort :: String -> IO Int
- epmdGetPortR4 :: String -> IO (Int, Int, Int, Int, Int, String, String)
- type ErlRecv = IO (Maybe ErlType, Maybe ErlType)
- type ErlSend = (Maybe ErlType, Maybe ErlType) -> IO ()
- erlConnect :: String -> String -> IO (ErlSend, ErlRecv)
- toNetwork :: Int -> Integer -> [Word8]
- genCall :: Erlang a => MBox -> Node -> Pid -> a -> IO ErlType
- genCast :: Erlang a => MBox -> Node -> Pid -> a -> IO ()
- rpcCall :: MBox -> Node -> String -> String -> [ErlType] -> IO ErlType
- rpcCast :: MBox -> Node -> String -> String -> [ErlType] -> IO ()
- backup :: MBox -> String -> String -> IO ErlType
- dirtyAllKeys :: MBox -> String -> String -> IO ErlType
- dirtyFirst :: MBox -> String -> String -> IO ErlType
- dirtyNext :: MBox -> String -> String -> ErlType -> IO ErlType
- dirtyLast :: MBox -> String -> String -> IO ErlType
- dirtyPrev :: MBox -> String -> String -> ErlType -> IO ErlType
- dirtyMatchObject :: MBox -> String -> ErlType -> IO ErlType
- dirtyRead :: MBox -> String -> String -> ErlType -> IO ErlType
- dirtySelect :: MBox -> String -> String -> ErlType -> IO ErlType
- data Self
- createSelf :: String -> IO Self
- data MBox
- createMBox :: Self -> IO MBox
- mboxRef :: MBox -> IO ErlType
- mboxSelf :: MBox -> ErlType
- type Node = String
- type Pid = Either ErlType String
- mboxRecv :: MBox -> IO ErlType
- mboxRecv' :: MBox -> ErlType -> IO ErlType
- mboxSend :: Erlang a => MBox -> Node -> Pid -> a -> IO ()
- data ErlType
- class Erlang a where
- toErlang :: a -> ErlType
- fromErlang :: ErlType -> a
- nth :: Erlang a => Int -> ErlType -> a
- getA :: Int -> Get [Char]
- getC :: Get Int
- getErl :: Get ErlType
- getN :: Get Int
- geta :: Int -> Get [Word8]
- getn :: Get Int
- putA :: String -> Put
- putC :: Int -> Put
- putErl :: ErlType -> PutM ()
- putN :: Int -> Put
- puta :: [Word8] -> Put
- putn :: Int -> Put
- tag :: Char -> Put
- erlangTimeToSeconds :: Integral a => ErlType -> a
- secondsToErlangTime :: Integral a => a -> ErlType
Low-level communication with the Erlang Port-Mapper Daemon.
epmdGetNames :: IO [String]Source
Return the names and addresses of all registered Erlang nodes.
epmdGetPort :: String -> IO IntSource
Return the port address of a named Erlang node.
epmdGetPortR4 :: String -> IO (Int, Int, Int, Int, Int, String, String)Source
Returns (port, nodeType, protocol, vsnMax, vsnMin, name, extra)
High-level communication.
rpcCall :: MBox -> Node -> String -> String -> [ErlType] -> IO ErlTypeSource
rpc:call(Node, Module, Function, Arguments)
rpcCast :: MBox -> Node -> String -> String -> [ErlType] -> IO ()Source
rpc:cast(Node, Module, Function, Arguments)
Mnesia database methods.
Low-level communication.
Represents a Haskell node (program).
createSelf :: String -> IO SelfSource
Instantiate a Haskell node. This initializes the FFI.
Represents a Haskell process (thread).
Haskell threads don't natively have Erlang process IDs. Instead, we use a mailbox abstraction that we can assign PIDs to for communication with Erlang.
createMBox :: Self -> IO MBoxSource
Create a new process on the Haskell side. Usually corresponds to a thread but doesn't need to.
Represents Erlang nodes and processes.
type Pid = Either ErlType StringSource
Represents a foreign (Erlang) process. A process can be identified either by its low-level ID (Left pid) or by its registered name (Right name).
Communication to/from Erlang.
mboxRecv' :: MBox -> ErlType -> IO ErlTypeSource
Receive a reply message. That is, looks for the next message identified by the given reference.
Native Erlang data types.
Haskell representation.
Conversion between native Haskell types and ErlType.
Erlang Bool | |
Erlang Int | |
Erlang Integer | |
Erlang String | |
Erlang ErlType | |
Erlang a => Erlang [a] | |
Erlang [ErlType] | |
(Erlang a, Erlang b) => Erlang (a, b) | |
(Erlang a, Erlang b, Erlang c) => Erlang (a, b, c) | |
(Erlang a, Erlang b, Erlang c, Erlang d) => Erlang (a, b, c, d) | |
(Erlang a, Erlang b, Erlang c, Erlang d, Erlang e) => Erlang (a, b, c, d, e) |
Easy type-safe access to tuple members.
Internal packing functions.
Miscellaneous utilities.
erlangTimeToSeconds :: Integral a => ErlType -> aSource
Convert a tuple (from erlang:now()) to seconds from Jan 1, 1970.
secondsToErlangTime :: Integral a => a -> ErlTypeSource
Convert seconds to an Erlang tuple representing time.