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
;; Type indexed values in 1ML | |
;; | |
;; This is a very simple experiment at encoding type-indexed values in 1ML. | |
;; | |
;; Background: | |
;; | |
;; https://people.mpi-sws.org/~rossberg/1ml/ | |
;; http://repository.readscheme.org/ftp/papers/zheyang-icfp98.pdf | |
;; | |
;; Run as: |
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
;; ----------------------------------------------------------------------------- | |
;; Unit type | |
Unit :> { | |
type t; | |
one : t; | |
} = { | |
type t = bool; | |
one = true; | |
}; |
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
let id x => x; | |
let always x _ => x; | |
let (>>) f g x => g (f x); | |
let (<|) f x => f x; | |
module Option = { | |
type t 'a = option 'a; | |
let toArray xO => switch xO { | |
| None => [||] | |
| Some x => [|x|] |
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 * as R from "ramda" | |
import React from "react" | |
// Rules from http://www.cse.tkk.fi/fi/opinnot/CSE-A1121/English2015/harjoitukset/kierros_2/harj_1/index.html | |
// Nope, I haven't rigorously checked that I implemented the rules correctly. | |
const consonantRule = | |
R.replace(/([aeiouyäö])([b-df-hj-np-tvwxz]*)([b-df-hj-np-t-tvwxz])([aeiouyäö])/gi, | |
"$1$2\xAD$3$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
// So called van Laarhoven lenses, named after their discoverer, have a number | |
// of nice properties as explained by Russell O'Connor: | |
// | |
// http://r6.ca/blog/20120623T104901Z.html | |
// | |
// Unfortunately their typing (in Haskell) | |
// | |
// type Lens s t a b = forall f. Functor f => (a -> f b) -> (s -> f t) | |
// | |
// seems to be well outside of what can be achieved in F#. |
NewerOlder