This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import readline from "readline-sync" | |
// Side effects | |
class EffectfulImplementation { | |
getUserInput () { | |
return readline.question("> ") | |
} | |
listTodoItems () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function numberField (key) { | |
return { | |
action: "numberField", | |
key, | |
} | |
} | |
function stringField (key) { | |
return { | |
action: "stringField", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import readline from "readline-sync" | |
function read () { | |
return { | |
action: "read", | |
next: pure, | |
} | |
} | |
function print (string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Module | |
( secretNumber | |
) where | |
secretNumber :: Int | |
secretNumber = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OtherModule | |
( secretString | |
) where | |
import Module | |
secretString :: String | |
secretString = show secretNumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.Text as T | |
import OtherModule | |
main :: IO () | |
main = T.putStrLn (T.pack secretString) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
nixpkgs = builtins.fetchGit { | |
url = "https://github.com/NixOS/nixpkgs.git"; | |
rev = "05626cc86b8a8bbadae7753d2e33661400ff67de"; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
args@{ ... }: | |
let | |
sources = import ./sources.nix; | |
nixpkgs = import sources.nixpkgs (args // { | |
overlays = [ | |
(import ./haskell/overlay.nix) | |
]; | |
}); |