git.iko.soy/typeable/http-api-data
on master help sign in
Add annotations to emphasize lower casing and case insensitivity
afcb507Nickolay Kudasov
Web/HttpApiData/Internal.hs+15−5
@@ -104,7 +104,9 @@ parseMaybeTextData parse input =
104 Just val -> Right val
104 Just val -> Right val
105
105
106#if USE_TEXT_SHOW
106#if USE_TEXT_SHOW
107+-- | /Lower case/.
108+--
107−-- | Convert to URL piece using @'TextShow'@ instance.
109+-- Convert to URL piece using @'TextShow'@ instance.
108-- The result is always lower cased.
110-- The result is always lower cased.
109--
111--
110-- >>> showTextData True
112-- >>> showTextData True
@@ -124,7 +126,9 @@ parseMaybeTextData parse input =
124showTextData :: TextShow a => a -> Text
126showTextData :: TextShow a => a -> Text
125showTextData = T.toLower . showt
127showTextData = T.toLower . showt
126#else
128#else
129+-- | /Lower case/.
130+--
127−-- | Convert to URL piece using @'Show'@ instance.
131+-- Convert to URL piece using @'Show'@ instance.
128-- The result is always lower cased.
132-- The result is always lower cased.
129--
133--
130-- >>> showTextData True
134-- >>> showTextData True
@@ -144,7 +148,9 @@ showt :: Show a => a -> Text
144showt = T.pack . show
148showt = T.pack . show
145#endif
149#endif
146
150
151+-- | /Case insensitive/.
152+--
147−-- | Parse given text case insensitive and return the rest of the input.
153+-- Parse given text case insensitive and return the rest of the input.
148--
154--
149-- >>> parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
155-- >>> parseUrlPieceWithPrefix "Just " "just 10" :: Either Text Int
150-- Right 10
156-- Right 10
@@ -165,7 +171,9 @@ parseUrlPieceWithPrefix pattern input
165 (prefix, rest) = T.splitAt (T.length pattern) input
171 (prefix, rest) = T.splitAt (T.length pattern) input
166
172
167#if USE_TEXT_SHOW
173#if USE_TEXT_SHOW
174+-- | /Case insensitive/.
175+--
168−-- | Parse values case insensitively based on @'TextShow'@ instance.
176+-- Parse values case insensitively based on @'TextShow'@ instance.
169--
177--
170-- >>> parseBoundedTextData "true" :: Either Text Bool
178-- >>> parseBoundedTextData "true" :: Either Text Bool
171-- Right True
179-- Right True
@@ -185,7 +193,9 @@ parseUrlPieceWithPrefix pattern input
185-- @
193-- @
186parseBoundedTextData :: forall a. (TextShow a, Bounded a, Enum a) => Text -> Either Text a
194parseBoundedTextData :: forall a. (TextShow a, Bounded a, Enum a) => Text -> Either Text a
187#else
195#else
196+-- | /Case insensitive/.
197+--
188−-- | Parse values case insensitively based on @'Show'@ instance.
198+-- Parse values case insensitively based on @'Show'@ instance.
189--
199--
190-- >>> parseBoundedTextData "true" :: Either Text Bool
200-- >>> parseBoundedTextData "true" :: Either Text Bool
191-- Right True
201-- Right True