From cd5091c4a3ab1c05b48ff3ad2fea666d77b8e39c Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 11 Aug 2017 01:08:30 -0400 Subject: Reply to Announce with AnnounceResponse. --- src/Network/QueryResponse.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Network/QueryResponse.hs') diff --git a/src/Network/QueryResponse.hs b/src/Network/QueryResponse.hs index 190cc73e..11fe7c32 100644 --- a/src/Network/QueryResponse.hs +++ b/src/Network/QueryResponse.hs @@ -181,6 +181,16 @@ data MethodHandler err tid addr x = forall a b. MethodHandler , noreplyAction :: addr -> a -> IO () } +contramapAddr :: (a -> b) -> MethodHandler err tid b x -> MethodHandler err tid a x +contramapAddr f (MethodHandler p s a) + = MethodHandler + p + (\tid src dst result -> s tid (f src) (f dst) result) + (\addr arg -> a (f addr) arg) +contramapAddr f (NoReply p a) + = NoReply p (\addr arg -> a (f addr) arg) + + -- | Attempt to invoke a 'MethodHandler' upon a given inbound query. If the -- parse is successful, the returned IO action will construct our reply if -- there is one. Otherwise, a parse err is returned. -- cgit v1.2.3