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
6b2651b1
Commit
6b2651b1
authored
Nov 23, 2018
by
Nicolas Lenz
Browse files
Add double-struck style
parent
cfe3c99b
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Main.hs
View file @
6b2651b1
...
...
@@ -34,7 +34,8 @@ styles = [
(
"space2"
,
toIO
$
letterspace
2
),
(
"space3"
,
toIO
$
letterspace
3
),
(
"upper"
,
toIO
$
map
toUpper
),
(
"lower"
,
toIO
$
map
toLower
)]
(
"lower"
,
toIO
$
map
toLower
),
(
"double"
,
toIO
$
map
toDS
)]
-- |Lifts a simple function into an IO operation simply returning what the function would return.
toIO
::
(
a
->
b
)
->
(
a
->
IO
b
)
...
...
src/Mock.hs
View file @
6b2651b1
module
Mock
(
mockAlternate
,
mockRandom
,
letterspace
)
where
module
Mock
(
mockAlternate
,
mockRandom
,
letterspace
,
toDS
)
where
import
Data.Char
import
Data.List
...
...
@@ -26,3 +26,17 @@ mockRandom str = do
-- |Letterspaces a String with the given number of blanks between the Chars.
letterspace
::
Int
->
String
->
String
letterspace
n
=
intercalate
(
replicate
n
' '
)
.
map
(
\
c
->
[
c
])
toDS
::
Char
->
Char
toDS
'C'
=
chr
8450
toDS
'H'
=
chr
8461
toDS
'N'
=
chr
8469
toDS
'P'
=
chr
8473
toDS
'Q'
=
chr
8474
toDS
'R'
=
chr
8477
toDS
'Z'
=
chr
8484
toDS
c
|
48
<=
ord
c
&&
ord
c
<=
57
=
chr
$
ord
c
-
48
+
120792
-- Number
|
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
toDS
c
=
c
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