File: test_server.hs

package info (click to toggle)
haskell-haxr 3000.11.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: haskell: 1,539; makefile: 16
file content (18 lines) | stat: -rw-r--r-- 357 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- A simple server

import System.Time
import Network.XmlRpc.Server

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

time :: IO CalendarTime
time = getClockTime >>= toCalendarTime

fault :: IO Int -- dummy
fault = fail "blaha"

main = cgiXmlRpcServer [
     ("examples.add", fun add),
     ("echo.fault", fun fault),
     ("examples.time", fun time)]