This file contains hidden or 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
pkgs: args: | |
with pkgs; | |
let defaultAttrs = rec { | |
system = builtins.currentSystem; | |
builder = "${bash}/bin/bash"; | |
args = [ ./builder.sh ]; | |
setup = ./setup.sh; | |
gcc = clang; | |
binutils = clang.bintools.bintools_bin; | |
baseInputs = [ |
This file contains hidden or 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 Html exposing (text, div, p) | |
-- based on https://medium.com/@drboolean/monoidal-contravariant-functors-are-actually-useful-1032211045c4#.r6oaoxdxd | |
-- Order | |
concatOrder : Order -> Order -> Order | |
concatOrder a b = | |
if a == EQ then |
This file contains hidden or 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 Html exposing (text) | |
import String | |
type alias ZipList a b = List (a -> b) | |
zipper : ZipList number number | |
zipper = [(*) 1, (*) 2, (*) 3] | |
zipper2 : ZipList number number | |
zipper2 = [(*) 1, (*) 2, (*) 3, (*) 4] |
This file contains hidden or 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 Html exposing (Html, Attribute, text, div, input, button) | |
import Html.App exposing (program) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (onInput, onClick) | |
import List | |
import String | |
import Char | |
import Random | |
-- Model |
This file contains hidden or 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 Html exposing (text) | |
import String | |
fizzbuzz : Int -> List String | |
fizzbuzz to = | |
let | |
current = | |
case (to % 3, to % 5) of | |
(0, 0) -> "Fizz Buzz" |
This file contains hidden or 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 Html exposing (..) | |
type These a b | |
= This a | |
| That b | |
| Both a b | |
| Neither |
This file contains hidden or 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
const l = console::console.log | |
const safeProp = prop => R.compose(S.toMaybe, R.prop(prop)) | |
const withDefault = R.curry((def, safeFun) => (...args) => { | |
const maybe = safeFun(...args) | |
return S.maybe(def, R.identity, maybe) | |
}) | |
const name = withDefault('anon', safeProp('name')) |
This file contains hidden or 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
const log = R.map(R.compose(console::console.log, R.toString)); | |
const saveProp = x => R.pipe(R.prop(x), S.toMaybe) | |
var xSave = R.lens(saveProp('x'), R.assoc('x')); | |
var xLens = R.lens(R.prop('x'), R.assoc('x')); | |
log([ | |
R.view(xLens, {x: 1, y: 2}) | |
, R.view(xLens, {noX: 1, y: 3}) | |
, R.view(xSave, {noX: 1, y: 3}) | |
, R.set(xLens, 4, {x: 1, y: 2}) |
This file contains hidden or 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
const even = R.converge(R.equals, [R.always(0), R.modulo(R.__,2)]); | |
const odd = R.converge(R.equals, [R.always(1), R.modulo(R.__,2)]); | |
// 1. map/filter implemented with reduce | |
// map with reduce | |
const map = (f, functor) => | |
R.reduce((acc, next) => R.concat(acc, f(next)), [], functor) |
This file contains hidden or 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 { | |
compose, | |
initialState, | |
didMount | |
} from 'react'; | |
export const MyComponent = compose( | |
initialState( () => { | |
return { | |
hidden: true |
NewerOlder