blunt 0.0.15 → 0.0.16
raw patch · 5 files changed
+38/−16 lines, 5 filesdep +flowPVP ok
version bump matches the API change (PVP)
Dependencies added: flow
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−1
- blunt.cabal +2/−1
- library/Blunt.hs +8/−5
- library/Blunt/Markup.hs +18/−7
- library/Blunt/Script.hs +3/−2
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Change log +## v0.0.16 (2015-04-03)++- Fixed a bug that incorrectly decoded inputs from the URL.+- Added some explanatory text, ostensibly for SEO.+- Added a ping to the WebSocket client to keep the connection open.+ ## v0.0.15 (2015-03-29) - Switch to converting expressions over WebSockets.@@ -51,7 +57,7 @@ ## v0.0.5 (2015-03-19) -- Constraint versions of `pointfree` dependencies.+- Constrained versions of pointfree dependencies. ## v0.0.4 (2015-03-19)
blunt.cabal view
@@ -1,5 +1,5 @@ name: blunt-version: 0.0.15+version: 0.0.16 cabal-version: >=1.10 build-type: Simple license: MIT@@ -30,6 +30,7 @@ aeson ==0.8.*, bytestring ==0.10.*, clay ==0.10.*,+ flow ==1.*, http-types ==0.8.*, jmacro ==0.6.*, lucid ==2.*,
library/Blunt.hs view
@@ -2,6 +2,8 @@ module Blunt where +import Flow+ import Blunt.Markup (markup) import Control.Exception (SomeException, evaluate, handle) import Control.Monad (forever)@@ -16,7 +18,7 @@ import Network.Wai.Middleware.Gzip (def, gzip) import Network.Wai.Middleware.RequestLogger (logStdout) import Network.WebSockets (ServerApp, acceptRequest, defaultConnectionOptions,- receiveData, sendTextData)+ forkPingThread, receiveData, sendTextData) import Pointfree (pointfree) main :: IO ()@@ -28,14 +30,15 @@ ws :: ServerApp ws pending = do connection <- acceptRequest pending- forever $ do+ forkPingThread connection 30+ forever <| do message <- receiveData connection result <- convert message sendTextData connection (encode result) http :: Application-http = gzip def . logStdout $ \ request respond ->- respond $ case (requestMethod request, pathInfo request) of+http = logStdout .> gzip def <| \ request respond ->+ respond <| case (requestMethod request, pathInfo request) of ("GET", []) -> responseLBS status headers body where status = ok200 headers = [("Content-Type", "text/html; charset=utf-8")]@@ -54,7 +57,7 @@ } safePointfree :: String -> IO [String]-safePointfree = handle handler . evaluate . pointfree+safePointfree = pointfree .> evaluate .> handle handler handler :: SomeException -> IO [String] handler _ = return []
library/Blunt/Markup.hs view
@@ -2,6 +2,7 @@ module Blunt.Markup where +import Flow import Lucid import Blunt.Script (script)@@ -12,8 +13,8 @@ markup = renderBS html html :: Html ()-html = doctypehtml_ $ do- head_ $ do+html = doctypehtml_ <| do+ head_ <| do meta_ [ name_ "viewport" , content_ "initial-scale = 1, maximum-scale = 1, minimum-scale = 1, width = device-width"@@ -23,12 +24,12 @@ style_ [] style - body_ $ do+ body_ <| do h1_ "Blunt" - dl_ $ do+ dl_ <| do dt_ "Input"- dd_ $ do+ dd_ <| do input_ [ id_ "input" , placeholder_ "sum xs = foldr (+) 0 xs"@@ -45,8 +46,18 @@ dt_ "Pointful" dd_ (div_ [id_ "pointful"] "") - p_ $ do- a_ [href_ "https://github.com/tfausak/blunt"] $ do+ p_ <| do+ "Blunt converts Haskell expressions between the pointfree and "+ "pointful styles. It is a web front end to the "+ a_ [href_ "http://hackage.haskell.org/package/pointfree"]+ "pointfree"+ " and "+ a_ [href_ "http://hackage.haskell.org/package/pointful"]+ "pointful"+ " libraries."++ p_ <| do+ a_ [href_ "https://github.com/tfausak/blunt"] <| do "github.com/tfausak/blunt" script_ [] script
library/Blunt/Script.hs view
@@ -20,7 +20,8 @@ socket.onopen = \ { input.oninput = \ {- window.location.replace("#input=" + input.value);+ window.location.replace(+ "#input=" + encodeURIComponent(input.value)); socket.send(input.value); }; @@ -34,6 +35,6 @@ }; if (window.location.hash.indexOf("#input=") === 0) {- input.value = window.location.hash.substring(7);+ input.value = decodeURIComponent(window.location.hash.substring(7)); } }(); |]