Skip to content

Instantly share code, notes, and snippets.

@daniel-chambers
daniel-chambers / FreeAp.hs
Last active August 30, 2016 01:45 — forked from adbrowne/FreeAp.hs
Free Applicative Example
module Main where
import Lib
import Data.Monoid
import Data.Map (Map)
import Data.Maybe
import qualified Data.Map as Map
import Control.Concurrent (threadDelay)
import Control.Concurrent.Async
import Control.Applicative.Free
var system = require('system'),
env = system.env;
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @param testFx javascript condition that evaluates to a boolean,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
type Building = {
left : int
right : int
height : int
}
let buildings : Building[] = [| (* ... *) |]
let getHeight building = building.height
let getWidth building = building.right - building.left