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 / gist:caf924d931c5d0406022
Last active August 29, 2015 14:18
A special form with some tricks in hplayground . compile it with http://tryplayg.herokuapp.com/
import Haste.HPlay.View
import Prelude hiding (div)
main= runBody $ do
let id= atr "id"
type_= atr "type"
name= atr "name"
value= atr "value"
r <-div ! id "selectors" <<<(
( button "Form A" `pass` OnClick >> return True) <|>

In haskell, continuations have been right in front of your eyes all the time, Use then to undo actions by means of the backtracking effect added to the the hardworking programmer EDSL.

#A word on continuations# In Haskell, the continuation is the second parameter in the bind operation. While most languages that use imperative and eager execution have to resort to continuations to implement special kinds of flows -so the continuation play a central role in them- haskell has not such problem: It uses continuations natively; The monad instance define what each kind of computation has to do with these continuations.

a bind has two parameters: a closure and a continuation.

 x >>=(f1>>=(f2 >>=f3))

So at every moment you know what is the continuation. In any monad. You don't need any special Cont structure for this!!!. It is right there, in the monad instance:

@agocorona
agocorona / gist:32a101c358c98bb7085c
Last active May 25, 2016 02:05
Demo calculator for the cordova/phonegap application using Haskell: haste and hplayground
{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses #-}
-- Hello-World of the cordova/phonegap application using Haskell.
-- So that Haste-Haskell can be used to create hybrid smartphone applications
-- The original JavaScript hello world is installed following the instructions of this page
--
-- http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface
--
-- follow the steps to install the hello world app.
--
-- install the browser platform, the simplest one:
@agocorona
agocorona / cordova.hs
Last active September 25, 2015 16:31
--
-- Hello-World of the cordova/phonegap application using Haskell.
--
-- here is the screenshoot
--
-- https://twitter.com/AGoCorona/status/532948528621178880
--
-- So that Haste-Haskell can be used to create hybrid smartphone applications
--
-- The original cordova JavaScript hello world is installed following the instructions of this page
C:\Users\magocoal\OneDrive\Haskell\devel\tryhplay>git push heroku master
Initializing repository, done.
Total 0 (delta 0), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Haskell app detected
-----> Deploying with Haskell on Heroku
BUILDPACK_URL: http://github.com/mietek/haskel
l-on-heroku