git.iko.soy/typeable/http-api-data
on master help sign in
Change convert to parse in error message
62ce86fNickolay Kudasov
Web/HttpApiData.hs+1−1
@@ -31,7 +31,7 @@ import Web.HttpApiData.Internal
31-- >>> parseUrlPiece "false" :: Either Text Bool
31-- >>> parseUrlPiece "false" :: Either Text Bool
32-- Right False
32-- Right False
33-- >>> parseUrlPiece "something else" :: Either Text Bool
33-- >>> parseUrlPiece "something else" :: Either Text Bool
34−-- Left "could not convert: `something else'"
34+-- Left "could not parse: `something else'"
35--
35--
36-- Numbers:
36-- Numbers:
37--
37--
Web/HttpApiData/Internal.hs+3−3
@@ -49,7 +49,7 @@ class ToHttpApiData a where
49 toQueryParam :: a -> Text
49 toQueryParam :: a -> Text
50 toQueryParam = toUrlPiece
50 toQueryParam = toUrlPiece
51
51
52−-- | Convert value from HTTP API data.
52+-- | Parse value from HTTP API data.
53class FromHttpApiData a where
53class FromHttpApiData a where
54 {-# MINIMAL parseUrlPiece | parseQueryParam #-}
54 {-# MINIMAL parseUrlPiece | parseQueryParam #-}
55 -- | Parse URL path piece.
55 -- | Parse URL path piece.
@@ -66,7 +66,7 @@ class FromHttpApiData a where
66
66
67-- | Default parsing error.
67-- | Default parsing error.
68defaultParseError :: Text -> Either Text a
68defaultParseError :: Text -> Either Text a
69−defaultParseError input = Left ("could not convert: `" <> input <> "'")
69+defaultParseError input = Left ("could not parse: `" <> input <> "'")
70
70
71-- | Convert @'Maybe'@ parser into @'Either' 'Text'@ parser with default error message.
71-- | Convert @'Maybe'@ parser into @'Either' 'Text'@ parser with default error message.
72parseMaybeTextData :: (Text -> Maybe a) -> (Text -> Either Text a)
72parseMaybeTextData :: (Text -> Maybe a) -> (Text -> Either Text a)
@@ -95,7 +95,7 @@ showTextData = T.toLower . T.pack . show
95-- >>> parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
95-- >>> parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
96-- Right 10
96-- Right 10
97-- >>> parseUrlPieceWithPrefix "Left " "left" :: Either Text Bool
97-- >>> parseUrlPieceWithPrefix "Left " "left" :: Either Text Bool
98−-- Left "could not convert: `left'"
98+-- Left "could not parse: `left'"
99--
99--
100-- This can be used to implement @'FromHttpApiData'@ for single field constructors:
100-- This can be used to implement @'FromHttpApiData'@ for single field constructors:
101--
101--