Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Software
Mock
Commits
527141fd
Commit
527141fd
authored
Dec 01, 2018
by
Nicolas Lenz
Browse files
Fix
#6
: Implement b style
parent
2b0c759c
Changes
2
Show whitespace changes
Inline
Side-by-side
mock.cabal
View file @
527141fd
...
...
@@ -4,10 +4,10 @@ cabal-version: 2.2
--
-- see: https://github.com/sol/hpack
--
-- hash:
cc61a2ec4483abb568ec0d6c64b949ecd8f2e1c8a1043eb0fe598f5764d575e5
-- hash:
ec9b95839c1659b10e94e8e7a06f9cf42995aee18e1233fc5b873f59e3b122a4
name: mock
version: 3.
0
.0
version: 3.
1
.0
synopsis: GrEAt HAskeLL PrOGRaM to trANsForm tEXT
description: Please see the README at <https://git.eisfunke.com/software/mock#readme>
category: String
...
...
src/Mock.hs
View file @
527141fd
...
...
@@ -2,15 +2,16 @@
module
Mock
(
styles
,
mockAlternate
,
mockRandom
,
letterspace
,
toDouble
)
where
import
qualified
Data.Text
as
T
import
Data.Text
(
Text
)
import
Data.Char
import
Data.List
import
qualified
Data.Text
as
T
import
Data.Hashable
import
System.Random
-- |List of possible mock style names and their functions.
styles
::
[(
T
.
Text
,
T
.
Text
->
T
.
Text
)]
styles
::
[(
Text
,
Text
->
Text
)]
styles
=
[
(
"random"
,
mockRandom
),
(
"alternate"
,
mockAlternate
),
...
...
@@ -21,7 +22,8 @@ styles = [
(
"upper"
,
T
.
toUpper
),
(
"lower"
,
T
.
toLower
),
(
"double"
,
T
.
map
toDouble
),
(
"cc"
,
mockCC
)]
(
"cc"
,
mockCC
),
(
"b"
,
mockB
)]
-- |Transforms a String into uppercase where the corresponding list is True. For False the String isn't changed.
toUpperBy
::
[
Bool
]
->
T
.
Text
->
T
.
Text
...
...
@@ -60,3 +62,7 @@ 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"
-- |Repaclaces all occurences of "b" and "B" with B button emojis.
mockB
::
Text
->
Text
mockB
=
T
.
replace
"b"
"🅱️"
.
T
.
replace
"B"
"🅱️"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment