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