-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Convert between camel case and separated words style. -- -- Functions to transform Haskell source files and haddock(or -- HsColour)-produced HTML files from camel case to separated words or -- Haskell source from separated words to camel case. @package restyle @version 0.1.0 -- | Characters to visually separate words in compound identifiers. module Data.Transform.Separators -- | Unicode hyphen, U+2010 hyphen :: Char -- | Low line or underscore, U+005F lowLine :: Char -- | Double low line, U+2017 doubleLowLine :: Char -- | Wide low line, U+FF3F wideLowLine :: Char -- | Transform camelCased identifiers to separated_words. module Data.Transform.UnCamel -- | Transform identifiers in (haddock-produced) HTML files from camelCase -- to separated_words. -- -- The separation character is freely choosable, but it is recommended to -- take one of those in Transform.Separators. Since -- underscore-separated identifiers are used in some libraries, choosing -- lowLine may lead to confusion. -- -- The separation character is inserted between a lowercase character and -- an uppercase character immediately following. If that uppercase -- character is followed by a lowercase letter, it is also transformed to -- lower case. -- -- String literals appearing in haddock comments are also -- transformed. Deal with it or yell. unCamelHTML :: Char -> String -> String -- | Transform identifiers in (non-literate) source files from camelCase to -- separated_words. -- -- The separation character is freely choosable, but it is recommended to -- take one of those in Transform.Separators. Since -- underscore-separated identifiers are used in some libraries, choosing -- lowLine may lead to confusion. On the other hand, it is the -- only one which has a fighting chance of producing valid Haskell code. -- -- The separation character is inserted between a lowercase character and -- an uppercase character immediately following. If that uppercase -- charcter is followed by a lowercase letter, it is also transformed to -- lower case. -- -- Operators including two or more consecutive dashes are handled -- correctly, i.e. |-- or --: are not treated as the -- start of a line-comment. -- -- Single quotes in identifiers, as in foldl' or -- f'2''d, are not considered to begin a character literal. An -- unfortunate consequence of that and the simple algorithm is that in an -- expression like -- --
--   replicate 5'\\'
--   
-- -- (with no space between number and character literal), the closing -- quote is considered to begin a character literal. -- -- Comments are not transformed, which may lead to inconsistencies -- between code and comments. That may change in the future. unCamelSource :: Char -> String -> String -- | Transform separated_words identifiers to camelCase in Haskell source. -- Based on Richard O'Keefe's preprocessor hspp. module Data.Transform.Camel -- | Transform Haskell code written in separated_words style to the more -- common camelCase style. -- -- camelSource sep source removes all occurences of sep -- in identifiers in source between two letters of which the -- first is in lower case after processing and transforms the second to -- upper case. Thus camelSource '_' "a_b_c" == "aB_c" since -- after processing the first underscore, the second is no longer -- preceded by a lowercase letter. -- -- Comments (and String literals) are not transformed, so haddock -- comments may need manual fixing. camelSource :: Char -> String -> String