summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfozworth <>2015-03-20 20:28:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2015-03-20 20:28:00 (GMT)
commitb427fa00ee0cf7db4ac1ff9dda0f07fc198a7eab (patch)
tree013f407a9b4ff295bd090a95b1720b496812d7fb
parentc4c52b4f65dbbd77cb685cb76d67664f55069d69 (diff)
version 0.0.90.0.9
-rw-r--r--CHANGELOG.md5
-rw-r--r--README.md4
-rw-r--r--blunt.cabal2
-rw-r--r--library/Blunt.hs41
4 files changed, 33 insertions, 19 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 706ff38..83e172e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Change log
+## v0.0.9 (2015-03-20)
+
+- Updated to list all intermediate steps instead of only the final result.
+- Optimized text input for mobile devices.
+
## v0.0.8 (2015-03-20)
- Created a simple stylesheet.
diff --git a/README.md b/README.md
index dfd253e..56c8026 100644
--- a/README.md
+++ b/README.md
@@ -59,8 +59,8 @@ $ echo '{}' > package.json
$ echo 'web: ./blunt' > Procfile
$ cp dist/build/blunt/blunt .
$ git add package.json Procfile blunt
-$ git commit --allow-empty-message
-$ git push heroku deploy:master
+$ git commit --allow-empty-message --message ''
+$ git push --force heroku deploy:master
$ git checkout master
$ git branch -D deploy
```
diff --git a/blunt.cabal b/blunt.cabal
index c370462..ff2ea28 100644
--- a/blunt.cabal
+++ b/blunt.cabal
@@ -1,5 +1,5 @@
name: blunt
-version: 0.0.8
+version: 0.0.9
cabal-version: >=1.10
build-type: Simple
license: MIT
diff --git a/library/Blunt.hs b/library/Blunt.hs
index 6d232f0..0e69eb6 100644
--- a/library/Blunt.hs
+++ b/library/Blunt.hs
@@ -10,7 +10,7 @@ import Network.HTTP.Types (notFound404, ok200)
import Network.Wai (Application, Request, Response, queryString, pathInfo,
requestMethod, responseLBS)
import Network.Wai.Handler.Warp (runEnv)
-import Pointfree (pointfree')
+import Pointfree (pointfree)
main :: IO ()
main = runEnv 8080 application
@@ -31,7 +31,7 @@ route request = case (requestMethod request, pathInfo request) of
indexAction :: Action
indexAction _request = do
- let headers = [("Content-Type", "text/html; charset=utf-8")]
+ let headers = [("Content-Type", "text/html")]
body = pack html
return (responseLBS ok200 headers body)
@@ -41,20 +41,20 @@ pointfreeAction request = do
input = case lookup "input" params of
Just (Just param) -> param
_ -> ""
- maybeOutput <- safePointfree (unpack input)
+ output <- safePointfree (unpack input)
let headers = [("Content-Type", "text/plain; charset=utf-8")]
- body = case maybeOutput of
- Just output -> pack output
- Nothing -> fromStrict input
+ body = if null output
+ then fromStrict input
+ else pack (unlines output)
return (responseLBS ok200 headers body)
notFoundAction :: Action
notFoundAction _request = return (responseLBS notFound404 [] "")
-safePointfree :: String -> IO (Maybe String)
-safePointfree = handle handler . evaluate . pointfree' where
- handler :: SomeException -> IO (Maybe String)
- handler _ = return Nothing
+safePointfree :: String -> IO [String]
+safePointfree = handle handler . evaluate . pointfree where
+ handler :: SomeException -> IO [String]
+ handler _ = return []
html :: String
html = unlines
@@ -62,7 +62,8 @@ html = unlines
, ""
, "<html>"
, " <head>"
- , " <meta name='viewport' content='initial-scale = 1, width = device-width'>"
+ , " <meta charset='utf-8'>"
+ , " <meta name='viewport' content='initial-scale = 1, maximum-scale = 1, minimum-scale = 1, width = device-width'>"
, ""
, " <title>Blunt</title>"
, ""
@@ -77,12 +78,12 @@ html = unlines
, " <dl>"
, " <dt>Input</dt>"
, " <dd>"
- , " <input id='input' placeholder='sum xs = foldr (+) 0 xs' autofocus>"
+ , " <input id='input' placeholder='sum xs = foldr (+) 0 xs' autocapitalize='none' autocomplete='off' autocorrect='off' autofocus spellcheck='false'>"
, " </dd>"
, ""
, " <dt>Output</dt>"
, " <dd>"
- , " <input id='output' placeholder='sum = foldr (+) 0' readonly>"
+ , " <div id='output'></div>"
, " </dd>"
, " </dl>"
, ""
@@ -137,15 +138,23 @@ css = unlines
, " margin: 0;"
, "}"
, ""
- , "input {"
+ , "input, div {"
, " border: thin solid #e0e0e0;"
, " box-sizing: border-box;"
, " font-family: monospace;"
, " font-size: 1em;"
+ , " width: 100%;"
+ , "}"
+ , ""
+ , "input {"
, " height: 3em;"
, " line-height: 3em;"
, " padding: 0 0.75em;"
- , " width: 100%;"
+ , "}"
+ , ""
+ , "div {"
+ , " padding: 0.75em;"
+ , " white-space: pre-wrap;"
, "}"
, ""
, "p {"
@@ -167,7 +176,7 @@ js = unlines
, ""
, " request.onreadystatechange = function () {"
, " if (request.readyState === 4 && request.status === 200) {"
- , " output.value = request.response;"
+ , " output.textContent = request.response;"
, " }"
, " };"
, " request.open('GET', '/pointfree?input=' + encodeURIComponent(input.value));"