Skip to content

Instantly share code, notes, and snippets.

View shterrett's full-sized avatar

Stuart Terrett shterrett

View GitHub Profile
@sergv
sergv / RecSchemesTypecheck.hs
Last active January 23, 2019 10:57
Use recursion schemes to add type information to expressions in a modular way
----------------------------------------------------------------------------
-- Tested with ghc 8.2.2
----------------------------------------------------------------------------
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TupleSections #-}
@Avaq
Avaq / combinators.js
Last active September 26, 2024 18:53
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@kachayev
kachayev / css-parser.md
Last active November 12, 2022 04:20
Parsing CSS file with monadic parser in Clojure
;; Autor: Paulo Suzart
;; This code reads a CSV file with a given format and then
;; talks to google to get its route name and generage a SQL output
;; just lein run it. No args to the main.
(ns geocoder.core
(import com.google.code.geocoder.Geocoder)
(import com.google.code.geocoder.GeocoderRequestBuilder)
(import com.google.code.geocoder.model.LatLng)
(import com.google.code.geocoder.model.GeocoderStatus)