The inflections package

[Tags:library, mit, test]

Inflections provides methods for singularization, pluralization, dasherizing, etc. The library is based on Rails' inflections library.

[Skip to Readme]


Change log
Dependencies base (>=4.6 && <5.0), exceptions (>=0.6 && <0.9), megaparsec (>=5.0 && <6.0), text (>=0.2 && <1.3), unordered-containers (>=0.2.7 && <0.3) [details]
License MIT
Copyright 2014–2016 Justin Leitgeb
Author Justin Leitgeb <>
Maintainer Justin Leitgeb <>
Stability Unknown
Category Text
Home page
Bug tracker
Source repository head: git clone
Uploaded Wed Dec 28 11:20:22 UTC 2016 by mrkkrp
Distributions LTSHaskell:, NixOS:, Stackage:, Tumbleweed:
Downloads 2541 total (20 in the last 30 days)
1 []
Status Docs available [build log]
Last success reported on 2016-12-28 [all 1 reports]




devTurn on development settings.DisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for inflections

Readme for inflections-

String Inflections for Haskell

License MIT Hackage Stackage Nightly Stackage LTS Build Status

This library is a partial port of the String Inflector from Ruby on Rails. It currently implements methods such as parameterize, transliterate, camelize, underscore and dasherize. Please see the haddock documentation for a complete list of the functions implemented by this library.

Unlike the ActiveSupport (Rails) and Ember implementations of inflections, this library uses a parser to verify the input to functions like camelize. This is done to ensure that the output strings adhere to the syntax that they are supposed to generate. You can read more about the philosophy behind this library in the Haddock documentation.


The following examples demonstrate usage of the parameterize, transliterate and camelize functions:

λ: parameterize "Hola. ¿Cómo estás?"

λ: transliterate "Hola. ¿Cómo estás?"
"Hola. ?Como estas?"

λ: import Control.Monad (liftM)
λ: liftM camelize $ parseSnakeCase "hey_there"


Part of parameterizing strings is approximating all characters in the input encoding to ASCII characters. This library copies the character approximation table from the Ruby i18n library. This data structure is provided as defaultCharacterTransliterations. You can provide your own transliteration map by passing a Map structure (from Data.Map) to the parameterizeCustom function.

If you want to specify a custom default replacement or approximation table for the transliterate function, you should instead call the transliterateCustom function which accepts a String for replacements and a Map for substitution.


I'd like this library to implement other functions found in the Rails inflections library. If you need one of those functions, please submit a pull request!

Further documentation

For more information, please see the the Haddock docs for this module.


Justin Leitgeb


You may submit pull requests to this repository on GitHub. Tests are appreciated with your contribution.


MIT - see the LICENSE file.