This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| port=`echo ${3} | awk -F/ '{print $(3)}'` | |
| docker run -it -p ${port}:${port} -v $(pwd):/work agocorona/transient:01-27-2017 bash -c "mkdir -p static && ghcjs --make /work/${1} -o static/out && runghc /work/${1} ${2} ${3}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ./buildrun2.sh | |
| {-# LANGUAGE CPP, NoMonomorphismRestriction, DeriveDataTypeable #-} | |
| module Main where | |
| import Prelude hiding (div,id) | |
| import Transient.Internals |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| -- haskell-transient application for the websocket shootout | |
| -- https://github.com/hashrocket/websocket-shootout | |
| -- this is the implementation of the benchmark with the transient libraries | |
| -- https://github.com/transient-haskell | |
| import Transient.Internals |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cb <- syncCallback1 ContinueAsync | |
| (\r -> do | |
| (x,y) <-fromJSValUnchecked r | |
| stopPropagation r | |
| print (x, y)) | |
| js_addEventListener elem "mousemove" cb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Transient.Base | |
| import Network | |
| import System.IO | |
| import Control.Monad.IO.Class | |
| import Control.Applicative | |
| -- taken from Pipes example | |
| -- https://www.reddit.com/r/haskell/comments/2jvc78/simple_haskell_irc_client_in_two_lines_of_code/?st=iqj5yxg1&sh=0cb8cc11 | |
| -- Simple Haskell IRC client in "two lines of code" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Lib | |
| import Model | |
| import GHCJS.HPlay.View hiding (input, option, pack) | |
| import qualified GHCJS.Perch as P (input) | |
| import Transient.Base | |
| import Transient.Move |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef ghcjs_HOST_OS | |
| static= id | |
| dynamic= id | |
| strip= id | |
| inputInt :: Maybe Int -> TransIO Int | |
| inputInt _ = empty | |
| inputSubmit :: String -> TransIO String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| in chrome console: | |
| JavaScript exception: ReferenceError: h$closeWebSocket is not defined | |
| rts.js:9543 user error (If you can read this, shutdownHaskellAndExit did not exit.) | |
| rts.js:9543 user error (If you can read this, shutdownHaskellAndExit did not exit.) | |
| rts.js:9543 user error (If you can read this, shutdownHaskellAndExit did no | |
| .... | |
| .... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Network | |
| import Network.Socket hiding (listen, accept) | |
| import System.IO | |
| import Control.Concurrent | |
| import Control.Monad | |
| import Control.Monad.IO.Class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- normally to be used with autoRefresh and pageFlow when used with other widgets. | |
| authenticateWidget :: View Html IO () | |
| authenticateWidget= wform $ do | |
| username <- getCurrentUser | |
| if username /= anonymous | |
| then do | |
| private; noCache;noStore | |
| return username -- if it is logged alredy, return username to the first wcallback | |
| else do -- if not it tries to get the user/pass from the paramenters and log in if the user sent login/passw | |
| (name, pass) <- (,) <$> (getString Nothing <! hint "login name" |