First I install some apps. I try to use the AppStore for everything if I can, buth unfortunately that’s not possible. YMMV.
{-# LANGUAGE RecordWildCards, Arrows #-} | |
import Numeric | |
import Data.Char | |
import Control.Monad | |
import Data.Monoid ((<>)) | |
import Data.List (nub, sort, reverse) | |
data RepeatBounds = RB |
This blog post series has moved here.
You might also be interested in the 2016 version.
var child_process = require('child_process'); | |
exports.handler = function(event, context) { | |
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' }); | |
proc.on('close', function(code){ | |
if(code !== 0) { | |
return context.done(new Error("Process exited with non-zero status code")); | |
} |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Lens -- lens | |
import Control.Monad.IO.Class -- transformers | |
import Control.Monad.Trans.AWS -- amazonka | |
import Network.AWS.EC2 -- amazonka-ec2 | |
main :: IO () |
(require '[clojure.test :as test]) | |
; Rewrite clojure.test to generate data structures instead of writing to | |
; stdout | |
(def ^:dynamic *results* | |
"Bound dynamically to an atom wrapping a vector of test report maps") | |
(defn add-name | |
"Given a testing report map, assoc's on a :name derived from the current | |
`clojure.test/testing` context." |
This is material to go along with a 2014 Boston Haskell talk.
We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.
Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?
wrangle :: Int -> Int
#!/bin/bash | |
# Check out the blog post at: | |
# | |
# http://www.philipotoole.com/influxdb-and-grafana-howto | |
# | |
# for full details on how to use this script. | |
AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname | |
INFLUXDB_DATABASE=test1 |
Fire up ghci. Make the text real big. Always show the types for everything as you go!
Takes ~1 hour generally.
Note: if you object to "uncertainty" (evocative of data/value flow possibilities), consider wording like "simultaneously possible values". It's a reference to how the compiler won't know whether Maybe a
is a Just a
or a Nothing
statically. Don't blather at me about dependent types; I know.
Alternate verbiage for uncertainty: product - simultaneous altogetherness, sum - simultaneous singlehood. Also consider what the category theoretic diagrams look like. Can be instructive.
Suggestions taken under advisement.
import Control.Monad.State | |
type App = StateT String IO | |
main :: IO () | |
main = do | |
x <- runStateT code "" | |
print x -- ("stateResult","stateValue") | |
return () |