 . snd) . readFloat

simpleParseFloatT :: (RealFrac a) => Text -> Maybe a
simpleParseFloatT = simpleParseFloat . T.unpack


nonEmptyJsonText :: String        -- ^ error message
                 -> Text          -- ^ parsed text, returned unchanged if non-empty
                 -> Parser Text
nonEmptyJsonText msg t = do
  if null t
     then fail msg
     else return t

boolToInt :
loadWreqResponseContentAndMime :: (MonadIO m)
                                => Handle -- ^ 因为使用了 hGetContents ，Handle 会关闭
                                -> m FileContentAndMime
loadWreqResponseContentAndMime h = liftIO $ do
    lbs <- LB.hGetContents h
    either (const $ throwIO $ userError "cannot decode file as FileContentAndMime") return $ S.decodeLazy lbs
loadWreqResponseContentAndMime h = liftIO $ do
    lbs <- LB.hGetContents h
    either (const $ throwIO $ userError "cannot decode file as FileContentAndMime") return $ S.decodeLazy lbs