Skip to content

Instantly share code, notes, and snippets.

View agocorona's full-sized avatar
💭
Status at .... https://gitter.im/Transient-Transient-Universe-HPlay/Lobby

Alberto agocorona

💭
Status at .... https://gitter.im/Transient-Transient-Universe-HPlay/Lobby
View GitHub Profile
@agocorona
agocorona / error.txt
Last active November 6, 2015 14:06
A websockets program for ghcjs that fails with ghcjs 0.2.0 and ghcjs-base commit 23b1311
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
....
....
@agocorona
agocorona / fake.hs
Created February 9, 2016 16:52
fake perch-hplaygroud sample definitions
#ifndef ghcjs_HOST_OS
static= id
dynamic= id
strip= id
inputInt :: Maybe Int -> TransIO Int
inputInt _ = empty
inputSubmit :: String -> TransIO String
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
@agocorona
agocorona / IRCtransient.hs
Created July 12, 2016 09:37
Simple Haskell IRC client in "two lines of code"
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"
cb <- syncCallback1 ContinueAsync
(\r -> do
(x,y) <-fromJSValUnchecked r
stopPropagation r
print (x, y))
js_addEventListener elem "mousemove" cb
@agocorona
agocorona / hasrocker.hs
Last active March 7, 2019 10:02
[benchmarking for the [hasrocket shottout](https://github.com/hashrocket/websocket-shootout)
{-# 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
@agocorona
agocorona / distributedApps.hs
Created January 30, 2017 07:13
Transieent: a web with a map-reduce widget and a distributed chat
#!/usr/bin/env ./buildrun2.sh
{-# LANGUAGE CPP, NoMonomorphismRestriction, DeriveDataTypeable #-}
module Main where
import Prelude hiding (div,id)
import Transient.Internals
@agocorona
agocorona / runghcdockerWeb.sh
Created January 30, 2017 07:17
Sell script for the compilation with ghcjs and execution with runghc of transient programs with web nodes
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}"
from agocorona/transient-0.4.4.1
-- hplayground by mark mann
-- identify user and record round by round results
{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, UndecidableInstances #-}
module Main where
import Haste
import Haste.Foreign
import Haste.LocalStorage
import Haste.JSON (JSON(..))