Skip to content

Commit

Permalink
Optional ReqBody': Replace “bimap” with “first”
Browse files Browse the repository at this point in the history
  • Loading branch information
unclechu committed Oct 4, 2020
1 parent 50b50fa commit c766e36
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions servant-server/src/Servant/Server/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import Control.Monad.Trans
import Control.Monad.Trans.Resource
(runResourceT)
import Data.Bifunctor
(bimap)
(first)
import qualified Data.ByteString as B
import qualified Data.ByteString.Builder as BB
import qualified Data.ByteString.Char8 as BC8
Expand Down Expand Up @@ -684,11 +684,11 @@ instance ( AllCTUnrender list a, HasServer api context
in
fmap f (liftIO $ lazyRequestBody request) >>=
case (sbool :: SBool (FoldRequired mods), sbool :: SBool (FoldLenient mods), hasReqBody) of
(STrue, STrue, _) -> return . bimap cs id
(STrue, STrue, _) -> return . first cs
(STrue, SFalse, _) -> either (delayedFailFatal . serverErr) return
(SFalse, STrue, False) -> return . either (const Nothing) (Just . Right)
(SFalse, SFalse, False) -> return . either (const Nothing) Just
(SFalse, STrue, True) -> return . Just . bimap cs id
(SFalse, STrue, True) -> return . Just . first cs
(SFalse, SFalse, True) -> either (delayedFailFatal . serverErr) (return . Just)

instance
Expand Down

0 comments on commit c766e36

Please sign in to comment.