Rails-like inflections for Haskell
Go to file
Justin S. Leitgeb c2af533223 Merge pull request #1 from tomjaguarpaw/master
Small style tweaks, and widened bounds on base
2014-02-25 08:01:29 -05:00
test First commit 2014-02-25 00:00:52 -05:00
Text Small style tweaks 2014-02-25 09:11:37 +00:00
.travis.yml Add travis 2014-02-25 00:06:41 -05:00
inflections.cabal Widen bounds to include base 4.5 2014-02-25 09:11:44 +00:00
LICENSE First commit 2014-02-25 00:00:52 -05:00
README.md Add travis 2014-02-25 00:06:41 -05:00
Setup.hs First commit 2014-02-25 00:00:52 -05:00

String Inflections for Haskell

Build Status

This library is a partial port of the String Inflector from Ruby on Rails. Specifically, it implements the parameterize and dasherize functions from the Inflector.

Usage

The most common usage of this library at this point is to parameterize a URL. This is accomplished as follows:

λ: parameterize defaultTransliterations "¡Feliz año nuevo!"
"feliz-ano-nuevo"

Customization

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 parameterize function.

TODO

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!

Author

Justin Leitgeb justin@stackbuilders.com

Contributing

You may submit pull requests to this repository on GitHub. Please add property tests for any functional changes that you make to this library.

License

MIT - see the LICENSE file.