[Haskell-cafe] Re: Remote invocations in Haskell?

Gleb Alexeyev gleb.alexeev at gmail.com
Thu Mar 25 06:48:44 EDT 2010

Yves Parès wrote:
> Okay, well, apparently I have to rely on an external HTTP server. This is not
> very simple, is there another more suitable way to get RPC working in
> haskell?

Apparently it is possible to use Happstack as webserver, here's example 
I came up with:

import Network.XmlRpc.Server
import Happstack.Server.SimpleHTTP
import Control.Monad.Trans
import Data.ByteString.Lazy.Char8

add :: Int -> Int -> IO Int
add x y = return (x + y)

handler = do
   Body body <- rqBody `fmap` askRq
   liftIO $ handleCall (methods [("examples.add", fun add)]) (unpack body)

main = simpleHTTP (Conf 8080 Nothing) handler

More information about the Haskell-Cafe mailing list