Skip to content
GitLab
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
537740d7
Commit
537740d7
authored
Nov 22, 2018
by
Nicolas Lenz
Browse files
Add TODO
parent
9f0988e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Main.hs
View file @
537740d7
...
...
@@ -12,18 +12,18 @@ main = do
args
<-
getArgs
case
length
args
of
0
->
putStrLn
help
1
->
putStrLn
help
1
->
putStrLn
help
-- TODO: read from stdin
_
->
handle
args
handle
::
[
String
]
->
IO
()
handle
(
mod
e
:
text
)
=
transform
(
intercalate
" "
text
)
>>=
putStrLn
where
handle
(
styl
e
:
text
)
=
transform
(
intercalate
" "
text
)
>>=
putStrLn
where
transform
::
String
->
IO
String
transform
=
case
lookup
mode
mod
es
of
transform
=
case
lookup
style
styl
es
of
Just
f
->
f
Nothing
->
const
$
return
help
mod
es
::
[(
String
,
String
->
IO
String
)]
mod
es
=
[
styl
es
::
[(
String
,
String
->
IO
String
)]
styl
es
=
[
(
"random"
,
mockRandom
),
(
"alternate"
,
toIO
mockAlternate
),
(
"space"
,
toIO
$
mockSpace
1
),
...
...
@@ -39,4 +39,4 @@ toIO f = (\x -> return $ f x)
help
::
String
help
=
"Mock - a program to transform text.
\n\n\
\
Usage: mock [STYLE] [TEXT]
\n\
\
Styles: "
++
(
intercalate
", "
$
map
fst
mod
es
)
\
Styles: "
++
(
intercalate
", "
$
map
fst
styl
es
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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