Copyright | (c) 2012-2013 Gabriele Sales <gbrsales@gmail.com> |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
JSON-RPC methods.
Synopsis
- data Method m where
- data MethodError = MethodError !Int !Text
- data NamedMethod m
- method :: (FromJSON i, ToJSON o) => Text -> (i -> m (Either MethodError o)) -> NamedMethod m
- data Methods m
- fromList :: [NamedMethod m] -> Methods m
- lookup :: Methods m -> Text -> Maybe (Method m)
Documentation
A wrapper over a monadic function that can either succeed or fail with a
MethodError
.
Hides the input and output types.
data MethodError Source #
Represents an error with an integer code and a textual message.
Instances
Show MethodError Source # | |
Defined in Data.Conduit.JsonRpc.Methods showsPrec :: Int -> MethodError -> ShowS # show :: MethodError -> String # showList :: [MethodError] -> ShowS # | |
Eq MethodError Source # | |
Defined in Data.Conduit.JsonRpc.Methods (==) :: MethodError -> MethodError -> Bool # (/=) :: MethodError -> MethodError -> Bool # |
data NamedMethod m Source #
A Method
with a name.
method :: (FromJSON i, ToJSON o) => Text -> (i -> m (Either MethodError o)) -> NamedMethod m Source #
Builds a NamedMethod
given its name and function.
Useful in conjuction with fromList
.
Collection of NamedMethod
s.
fromList :: [NamedMethod m] -> Methods m Source #
Builds a collection from a list of NamedMethod
s.