Skip to content

Instantly share code, notes, and snippets.

View hakonrossebo's full-sized avatar

Håkon Rossebø hakonrossebo

View GitHub Profile

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@coreyhaines
coreyhaines / Flow.elm
Last active December 14, 2020 00:20
General workflow-management
module Flow exposing (Flow(..), map, withDefault, mapDefault, view, update)
import Html
type Flow state
= NotRunning
| Running state
@i-am-tom
i-am-tom / Main.elm
Created December 11, 2016 12:36
The Orrery
-- ## An Elm-entary visualisation
-- by _Tom Harding_
module Main exposing (..)
-- This project uses a few dependencies. To anyone who's written any
-- amount of Elm before, the only stranger is `AnimationFrame`, from
-- the `elm-lang/animation-frame` package. This lets us subscribe to
-- the browser's RAF API. Everything else should be fairly obvious:
-- `Html` / `Svg` for our view, `Http` / `Json.Decode` for the AJAX
@coreyhaines
coreyhaines / Editable.elm
Last active August 25, 2022 05:11
type Editable
module Editable exposing (..)
type Editable ofType
= NotEditing { value : ofType }
| Editing { originalValue : ofType, buffer : ofType }
value : Editable ofType -> ofType
value editable =
@swlaschin
swlaschin / ndclondon17_fp_track.md
Last active July 10, 2017 11:04
Functional Track talks from NDC London 2017

Functional Track talks from NDC London 2017

Also, here is the list of all videos from NDC London 2017:

Wednesday 2017-01-18

@mrange
mrange / RResult.md
Created March 18, 2017 12:32
Railway Oriented Programming and F# Result

Railway Oriented Programming and F# Result

Full source: https://gist.github.com/mrange/aa9e0898492b6d384dd839bc4a2f96a1

Option<_> is great for ROP (Railway Oriented Programming) but we get no info on what went wrong (the failure value is None which carries no info).

With the introduction F# 4.1 we got Result<_, _> a "smarter" Option<_> as it allows us to pass a failure value.

However, when one inspects the signature of Result.bind one sees a potential issue for ROP:

@danidiaz
danidiaz / Dockerfile
Last active September 20, 2018 13:28
docker + docker-compose for local Haskell development
from ubuntu:latest
run apt-get update && \
apt-get install -y emacs agda-mode agda-stdlib && \
apt-get install -y coq coqide && \
apt-get install -y openssh-server && \
apt-get install -y iproute2 wget curl && \
apt-get install -y bzip2 tmux git vim libgmp-dev python3 gcc libtinfo-dev zlib1g-dev xz-utils make && \
git config --global core.editor vim && \
git config --global alias.co checkout && \