Commit 925d5ba1 authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Add cc mode

parent 2db683f4
......@@ -4,7 +4,7 @@ cabal-version: 2.2
--
-- see: https://github.com/sol/hpack
--
-- hash: 17611a7df00c9bd277a9091735ad4a0705598afdc3db7b64ac5852af2f642fa8
-- hash: cc61a2ec4483abb568ec0d6c64b949ecd8f2e1c8a1043eb0fe598f5764d575e5
name: mock
version: 3.0.0
......@@ -36,7 +36,6 @@ library
, hashable
, random
, text
, time
default-language: Haskell2010
executable mock
......@@ -52,5 +51,4 @@ executable mock
, mock
, random
, text
, time
default-language: Haskell2010
......@@ -20,7 +20,8 @@ styles = [
("lines", T.intersperse '\n'),
("upper", T.map toUpper),
("lower", T.map toLower),
("double", T.map toDouble)]
("double", T.map toDouble),
("cc", mockCC)]
-- |Transforms a String into uppercase where the corresponding list is True. For False the String isn't changed.
toUpperBy :: [Bool] -> T.Text -> T.Text
......@@ -55,3 +56,7 @@ toDouble c
| 65 <= ord c && ord c <= 90 = chr $ ord c - 65 + 120120 -- Uppercase letter
| 97 <= ord c && ord c <= 122 = chr $ ord c - 97 + 120146 -- Lowercase letter
toDouble c = c
-- |Replaces all occurences of lowercase "ck" and "k" in a string with "cc"s.
mockCC :: T.Text -> T.Text
mockCC = T.replace "k" "cc" . T.replace "ck" "cc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment