blunt 0.0.8 → 0.0.9
raw patch · 4 files changed
+33/−19 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Blunt: safePointfree :: String -> IO (Maybe String)
+ Blunt: safePointfree :: String -> IO [String]
Files
- CHANGELOG.md +5/−0
- README.md +2/−2
- blunt.cabal +1/−1
- library/Blunt.hs +25/−16
CHANGELOG.md view
@@ -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.
README.md view
@@ -59,8 +59,8 @@ $ 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 ```
blunt.cabal view
@@ -1,5 +1,5 @@ name: blunt-version: 0.0.8+version: 0.0.9 cabal-version: >=1.10 build-type: Simple license: MIT
library/Blunt.hs view
@@ -10,7 +10,7 @@ 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 @@ 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 @@ 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>" , " <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 @@ , " <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,17 +138,25 @@ , " 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 {" , " margin: 1.5em 0 0 0;" , " text-align: center;"@@ -167,7 +176,7 @@ , "" , " 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));"