git.iko.soy/typeable/servant-reflex
on master help sign in
Derive Functor for ReqResult
ebc881dJoe Hermaszewski
src/Servant/Common/Req.hs+2−7
@@ -1,4 +1,5 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2+{-# LANGUAGE DeriveFunctor #-}
2{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE GADTs #-}
4{-# LANGUAGE GADTs #-}
4{-# LANGUAGE OverloadedStrings #-}
5{-# LANGUAGE OverloadedStrings #-}
@@ -43,6 +44,7 @@ data ReqResult tag a
43 -- a non-successful response code
44 -- a non-successful response code
44 | RequestFailure tag Text
45 | RequestFailure tag Text
45 -- ^ A failure to construct the request tagged with 'tag' at trigger time
46 -- ^ A failure to construct the request tagged with 'tag' at trigger time
47+ deriving (Functor)
46
48
47
49
48------------------------------------------------------------------------------
50------------------------------------------------------------------------------
@@ -83,13 +85,6 @@ reqTag (ResponseSuccess tag _ _) = tag
83reqTag (ResponseFailure tag _ _) = tag
85reqTag (ResponseFailure tag _ _) = tag
84reqTag (RequestFailure tag _ ) = tag
86reqTag (RequestFailure tag _ ) = tag
85
87
86−------------------------------------------------------------------------------
87−instance Functor (ReqResult tag) where
88− fmap f (ResponseSuccess tag a xhr) = ResponseSuccess tag (f a) xhr
89− fmap _ (ResponseFailure tag r x) = ResponseFailure tag r x
90− fmap _ (RequestFailure tag r) = RequestFailure tag r
91−
92−
93-------------------------------------------------------------------------------
88-------------------------------------------------------------------------------
94-- | You must wrap the parameter of a QueryParam endpoint with 'QParam' to
89-- | You must wrap the parameter of a QueryParam endpoint with 'QParam' to
95-- indicate whether the parameter is valid and present, validly absent, or
90-- indicate whether the parameter is valid and present, validly absent, or