Skip to content

Instantly share code, notes, and snippets.

View thoferon's full-sized avatar

Tom Feron thoferon

View GitHub Profile
@thoferon
thoferon / Module.hs
Created February 4, 2020 06:14
haskell-nix-setup
module Module
( secretNumber
) where
secretNumber :: Int
secretNumber = 4
@thoferon
thoferon / demo.cabal
Created February 4, 2020 06:14
haskell-nix-setup
cabal-version: 1.12
name: demo
version: 0.9.0
author: Tom Feron
maintainer: Tom Feron
build-type: Simple
library
hs-source-dirs: src
ghc-options: -Wall
We couldn’t find that file to show.
import _ from "underscore"
import game from "./sequentialActions.js"
function testInterpreter (program, inputs, accOutputs) {
switch (program.action) {
case "read":
const input = inputs[0]
const rest = inputs.slice(1)
return testInterpreter(program.next(input), rest, accOutputs)
import readline from "readline-sync"
function read () {
return {
action: "read",
next: pure,
}
}
function print (string) {
function numberField (key) {
return {
action: "numberField",
key,
}
}
function stringField (key) {
return {
action: "stringField",
import readline from "readline-sync"
// Side effects
class EffectfulImplementation {
getUserInput () {
return readline.question("> ")
}
listTodoItems () {
import parser from "./nonSequentialActions.js"
function generateDocumentation (parser) {
switch (parser.action) {
case "pure":
return null
case "stringField":
return { [parser.key]: "string" }
@thoferon
thoferon / .emacs
Last active December 22, 2015 20:59
Emacs configuration
;; Packages required :
;; jujube-theme
;; haskell-mode
;; ghc
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
@thoferon
thoferon / Pickle.hs
Created August 30, 2013 21:28
So, your PM is talking about Cucumber... Just an idea
import Control.Monad
import Control.Monad.Identity
import Control.Monad.Trans
import Control.Monad.Writer.Lazy
data Step
= Action String
| Assertion Bool String
deriving (Show, Eq)