@@ -117,7 +117,6 @@ where
118import Control.Monad.Catch (MonadThrow (..))
118import Control.Monad.Catch (MonadThrow (..))
119import Data.Text (Text)
119import Data.Text (Text)
120−import Data.Void (Void)
121import Text.Inflections.Camelize (camelize, camelizeCustom)
120import Text.Inflections.Camelize (camelize, camelizeCustom)
122import Text.Inflections.Dasherize (dasherize)
121import Text.Inflections.Dasherize (dasherize)
123import Text.Inflections.Data (Transliterations, defaultTransliterations)
122import Text.Inflections.Data (Transliterations, defaultTransliterations)
@@ -142,7 +141,7 @@ import Prelude hiding (Word)
143-- >>> toUnderscore "FooBarBazz"
142-- >>> toUnderscore "FooBarBazz"
144-- "foo_bar_bazz"
143-- "foo_bar_bazz"
145−toUnderscore :: Text -> Either (ParseErrorBundle Text Void) Text
144+toUnderscore :: Text -> Either (ParseError Char Dec) Text
146toUnderscore = fmap underscore . parseCamelCase []
145toUnderscore = fmap underscore . parseCamelCase []
148-- | Transforms CamelCasedString to snake-cased-string-with-dashes.
147-- | Transforms CamelCasedString to snake-cased-string-with-dashes.
@@ -151,7 +150,7 @@ toUnderscore = fmap underscore . parseCamelCase []
152-- >>> toDashed "FooBarBazz"
151-- >>> toDashed "FooBarBazz"
153-- "foo-bar-bazz"
152-- "foo-bar-bazz"
154−toDashed :: Text -> Either (ParseErrorBundle Text Void) Text
153+toDashed :: Text -> Either (ParseError Char Dec) Text
155toDashed = fmap dasherize . parseCamelCase []
154toDashed = fmap dasherize . parseCamelCase []
157-- | Transforms underscored_text to CamelCasedText. If first argument is
156-- | Transforms underscored_text to CamelCasedText. If first argument is
@@ -167,7 +166,7 @@ toDashed = fmap dasherize . parseCamelCase []
167toCamelCased
166toCamelCased
168 :: Bool -- ^ Capitalize the first character
167 :: Bool -- ^ Capitalize the first character
169 -> Text -- ^ Input
168 -> Text -- ^ Input
170− -> Either (ParseErrorBundle Text Void) Text -- ^ Output
169+ -> Either (ParseError Char Dec) Text -- ^ Output
171toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
170toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
173-- | Transforms underscored_text to space-separated human-readable text.
172-- | Transforms underscored_text to space-separated human-readable text.
@@ -186,10 +185,10 @@ toCamelCased c = fmap (camelizeCustom c) . parseSnakeCase []
186toHumanized
185toHumanized
187 :: Bool -- ^ Capitalize the first character
186 :: Bool -- ^ Capitalize the first character
188 -> Text -- ^ Input
187 -> Text -- ^ Input
189− -> Either (ParseErrorBundle Text Void) Text -- ^ Output
188+ -> Either (ParseError Char Dec) Text -- ^ Output
190toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
189toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
192−-- | Lift something of type @'Either' ('ParseError' 'Char' 'Void') a@ to
191+-- | Lift something of type @'Either' ('ParseError' 'Char' 'Dec') a@ to
193-- an instance of 'MonadThrow'. Useful when you want to shortcut on parsing
192-- an instance of 'MonadThrow'. Useful when you want to shortcut on parsing
194-- failures and you're in an instance of 'MonadThrow'.
193-- failures and you're in an instance of 'MonadThrow'.
@@ -197,6 +196,6 @@ toHumanized c = fmap (humanizeCustom c) . parseSnakeCase []
198-- /since 0.3.0.0/
197-- /since 0.3.0.0/
200−betterThrow :: MonadThrow m => Either (ParseErrorBundle Text Void) a -> m a
199+betterThrow :: MonadThrow m => Either (ParseError Char Dec) a -> m a
201betterThrow (Left err) = throwM (InflectionParsingFailed err)
200betterThrow (Left err) = throwM (InflectionParsingFailed err)
202betterThrow (Right x) = return x
201betterThrow (Right x) = return x