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
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
@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
@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:

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: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) <|>
#Introduction
This tutorial:
- Will show how the development of web applications, workflows, asynchronous tasks, Enterprise Application Integration(EAI), Service Integration and Business Process Management (BPM) face the same underlying problem, that may be called the integration problem. That is, in essence, a problem of inversion of control.
- Will show how the traditional architecture that solves that problem, the state-transition system, end up in the creation of complex frameworks with excessive configurations, standards, APIs and development environments specialized for each particular problem that hides the commonalities and make the integration prohibitively expensive and difficult to program and maintain, while the language Haskell permits the implementation of a common underlying solution for all these problems that is vastly simpler and intuitive.
- For a practical problem, you will learn how to program and test a long running task (a workflow) in a monadic sequence that will automatica

This article has been rewritten the 19/08/2015

Motivation (yours not mine)

The distributed framework that I´m developing is a completely different way to consider distributed computing in the same sense that Transient is a different way to program in Haskell or in any other language. It is so straighforward that is difficult to understand after decades of inversion of control, programming state machines objects framewors, routes and callbacks. If you dare to think different you will benefit from this higher level way of programming that I´m convinced that is the future.

It is the future because it is functionality oriented, not object oriented. A software functionality is a business process, that naturally compose with other business processes. A process is like physiology, while OOP is like anatomy. Functional programming is about composability, wether efectful or not. Transient is deeply functional and can express business functionalities in compact category theoretical expressions that compose, with

module Main where
import MFlow.Wai.Blaze.Html.All hiding( page)
import qualified MFlow.Wai.Blaze.Html.All as MF(page)
main= runNavigation "" $ transientNav testNav
testNav= do
@agocorona
agocorona / login.mflow.hs
Last active September 8, 2015 12:23
login widget. present login/pass button
-- 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"
@agocorona
agocorona / streamtest.hs
Created September 17, 2015 09:27
test for send buffer overflow
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