Skip to content

Instantly share code, notes, and snippets.

View PinkaminaDianePie's full-sized avatar

Igor PinkaminaDianePie

View GitHub Profile
/*
A collection of tests where Flow and TypeScript might have different behavior
Some tests are borrowed from https://github.com/vkurchatkin/typescript-vs-flow
Some tests now have the same behavior as the new versions of Flow/TS have fixed the bugs and improved type safety
*/
/* 1. Accessing unknown properties on objects */
@Centril
Centril / combinators.hs
Created January 13, 2017 21:35
useful higher order combinators in haskell
(.$) :: (t -> b -> c) -> (a -> b) -> t -> a -> c
(.$) f g a = f a . g
infixr 8 .$
-- | '.|': Compose an unary function with a binary function.
-- from: http://hackage.haskell.org/package/pointless-fun-1.1.0.5/docs/Data-Function-Pointless.html
(.|) :: (b -> c) -> (t -> a -> b) -> t -> a -> c
(.|) f g a = f . g a
infixr 7 .|
@Avaq
Avaq / combinators.js
Last active March 18, 2024 20:49
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))