git.iko.soy/typeable/servant-reflex
on master help sign in
Merge pull request #33 from expipiplus1/derive-functor

Derive Functor for ReqResult

commit8d67c122d4efa67f5f81b20d532473f2960b1b69 authorGreg Hale <ImAlsoGreg@gmail.com> dateSat 18 Mar 2017, 10:25 (10 years ago) parentbdc4dc3ebc881d
1 file changed+2−7
src/Servant/Common/Req.hs+2−7
src/Servant/Common/Req.hs+2−7
@@ -1,4 +1,5 @@
11{-# LANGUAGE CPP #-}
2+{-# LANGUAGE DeriveFunctor #-}
23{-# LANGUAGE FlexibleContexts #-}
34{-# LANGUAGE GADTs #-}
45{-# LANGUAGE OverloadedStrings #-}
@@ -43,6 +44,7 @@ data ReqResult tag a
4344 -- a non-successful response code
4445 | RequestFailure tag Text
4546 -- ^ A failure to construct the request tagged with 'tag' at trigger time
47+ deriving (Functor)
4648
4749
4850------------------------------------------------------------------------------
@@ -83,13 +85,6 @@ reqTag (ResponseSuccess tag _ _) = tag
8385reqTag (ResponseFailure tag _ _) = tag
8486reqTag (RequestFailure tag _ ) = tag
8587
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−
9388-------------------------------------------------------------------------------
9489-- | You must wrap the parameter of a QueryParam endpoint with 'QParam' to
9590-- indicate whether the parameter is valid and present, validly absent, or