summaryrefslogtreecommitdiff
path: root/tests/Shared.hs
blob: 1654764408fcf2674e30ded10872b560a406143d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE OverloadedStrings #-}
module Shared
       ( echoM
       , echoBytes
       , unitM
       , swapM
       , reverseM
       , shiftR
       , rawM
       , rawDictM
       ) where

import Data.ByteString (ByteString)
import Data.BEncode
import Network.KRPC

unitM :: Method () ()
unitM = method "unit" [] []

echoM :: Method Int Int
echoM = method "echo" ["x"] ["x"]

echoBytes :: Method ByteString ByteString
echoBytes = method "echoBytes" ["x"] ["x"]

reverseM :: Method [Int] [Int]
reverseM = method "reverse" ["xs"] ["ys"]

swapM :: Method (Int, Int) (Int, Int)
swapM = method "swap" ["x", "y"] ["b", "a"]

shiftR :: Method ((), Int, [Int]) ([Int], (), Int)
shiftR = method "shiftR" ["x", "y", "z"] ["a", "b", "c"]

rawM :: Method BValue BValue
rawM = method "rawM" [""] [""]

rawDictM :: Method BValue BValue
rawDictM = method "m" [] []