git.iko.soy/typeable/inflections-hs
on master help sign in
Documentation corrections
commit8820a16c497f2774fe786b50e9ebb25095a95978 authormrkkrp <markkarpov@opmbx.org> dateWed 28 Dec 2016, 13:48 (10 years ago) parentc964f2a
2 files changed+18−18
Text/Inflections.hs+16−16 Text/Inflections/Camelize.hs+2−2
Text/Inflections.hs+16−16
@@ -1,6 +1,6 @@
11-- |
22-- Module : Text.Inflections
3−-- Description : Rails-like inflections library for common String transformations.
3+-- Description : Rails-like inflections library for common Text transformations.
44-- Copyright : (c) Justin Leitgeb
55-- License : MIT
66--
@@ -8,7 +8,7 @@
88-- Stability : unstable
99-- Portability : portable
1010--
11−-- This module provides methods for common String transformations, similar
11+-- This module provides methods for common 'Text' transformations, similar
1212-- to the Inflections library found in Rails:
1313--
1414-- <http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html>
@@ -17,7 +17,7 @@
1717-- implementations in Rails' ActiveSupport, the philosophy of this library
1818-- is fundamentally different. Where Rails tries to be as permissive as
1919-- possible, and return a String when given any input, this library tries to
20−-- output strings that make sense according to the function that is called.
20+-- output 'Text' that makes sense according to the function that is called.
2121--
2222-- When you look closely at many of the functions in Rails' inflections
2323-- library, you will notice that many of them are partial. That is, they
@@ -33,7 +33,7 @@
3333-- >>> "foo bar".underscore
3434-- "foo bar"
3535--
36−-- The output isn't underscored - it contains a space! It turns out that
36+-- The output isn't underscored — it contains a space! It turns out that
3737-- some of the functions from Inflections in ActiveSupport are /partial/.
3838-- I.e., the outputs are really only specified for a certain range of the
3939-- inputs allowed by the String type.
@@ -42,7 +42,7 @@
4242-- results by separating the parsing of strings into tokens from the
4343-- application of transformations. Let's see an example.
4444--
45−-- First, we tokenize an underscored String using 'parseSnakeCase':
45+-- First, we tokenize an underscored 'Text' using 'parseSnakeCase':
4646--
4747-- >>> parseSnakeCase [] "foo_bar"
4848-- Right [Word "foo",Word "bar"]
@@ -79,8 +79,17 @@
7979{-# LANGUAGE CPP #-}
8080
8181module Text.Inflections
82− ( -- * Parsing
83− parseSnakeCase
82+ ( -- * Types and helpers
83+ Word
84+ , WordType (..)
85+ , mkWord
86+ , mkAcronym
87+ , unWord
88+ , SomeWord (..)
89+ , unSomeWord
90+ , InflectionException (..)
91+ -- * Parsing
92+ , parseSnakeCase
8493 , parseCamelCase
8594 -- * Rendering
8695 , camelize
@@ -97,15 +106,6 @@ module Text.Inflections
97106 , transliterateCustom
98107 , ordinalize
99108 , ordinal
100− -- * Types and helpers
101− , Word
102− , WordType (..)
103− , mkWord
104− , mkAcronym
105− , unWord
106− , SomeWord (..)
107− , unSomeWord
108− , InflectionException (..)
109109 -- * Often used combinators
110110 , toUnderscore
111111 , toDashed
Text/Inflections/Camelize.hs+2−2
@@ -29,7 +29,7 @@ import Control.Applicative
2929--
3030-- >>> foo <- SomeWord <$> mkWord "foo"
3131-- >>> bar <- SomeWord <$> mkAcronym "bar"
32−-- >>> bazz <- SomeWord <$> mkAcronym "bazz"
32+-- >>> bazz <- SomeWord <$> mkWord "bazz"
3333-- >>> camelize [foo,bar,bazz]
3434-- "FoobarBazz"
3535camelize
@@ -41,7 +41,7 @@ camelize = camelizeCustom True
4141--
4242-- >>> foo <- SomeWord <$> mkWord "foo"
4343-- >>> bar <- SomeWord <$> mkAcronym "bar"
44−-- >>> bazz <- SomeWord <$> mkAcronym "bazz"
44+-- >>> bazz <- SomeWord <$> mkWord "bazz"
4545-- >>> camelizeCustom False [foo,bar,bazz]
4646-- "foobarBazz"
4747camelizeCustom