Skip to content

Instantly share code, notes, and snippets.

@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

@safareli
safareli / phantom_container.js.md
Last active October 12, 2016 07:43
Phantom `empty` value and Phantom container compatible with Fantasy Land

See WIP implementation HERE

In Haskell we can define Monoid instances like this:

instance Monoid b => Monoid (Identity b) where
  mempty = mempty
  mappend (Identity a) (Identity b) = Identity (a `mappend` b)

instance (Monoid a, Monoid b) => Monoid (Pair a b) where
@xgrommx
xgrommx / 01-future.js
Created June 26, 2016 20:52 — forked from spion/01-future.js
Future and ReaderT with auto-lifting and example
class Future {
constructor(computation) {
this.fork = computation
this.__future__ = true;
}
static is(val) {
return (val != null && val.__future__ === true)
}
static of(value) {
if (Future.is(value)) return value;
20:10 dat-gitter-bot> (scriptjs) @mafintosh can you contrast hyperlog vs hypercore for their log capabilities, you dropped hypercore at some point. Is hypercore by itself as useful for an append only log use case?
20:10 <•mafintosh> @scriptjs right
20:10 <•mafintosh> so hyperlog is a DAG structure (a merkle dag even)
20:10 <•mafintosh> where data you insert can point to other data you insert
20:10 <•mafintosh> which is really great if you have multiple peers collaborating on the same data structure
20:11 <•mafintosh> a hyperlog is also always fully replicated since that makes the replication protocol pretty trivial
20:11 <•mafintosh> (i really need to write some white paper on that at some point)
20:11 <•mafintosh> hypercore is just simple single-writer append-only logs
20:11 <•mafintosh> so abstraction-wise hyperlog > hypercore
20:12 <•mafintosh> we could even make hyperlog run on top of hypercore which i really wanna do
@hcoles
hcoles / cfp.md
Last active February 29, 2016 09:58
Almost functional call for papers

Update 29/02/2016

The call is now closed. Thanks to eveyone that submitted

What is this?

This is a lightweight call for speakers for "Almost Functional", a one-off, free, evening event in Edinburgh on the 14th of April.

Please spread this URL far and wide.

@Avaq
Avaq / combinators.js
Last active May 19, 2024 00:21
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))
@DrBoolean
DrBoolean / mcft.js
Created December 30, 2015 04:44
Monoidal Contravariant Functors and Transducers
const daggy = require('daggy');
const {foldMap} = require('pointfree-fantasy')
const {concat, toUpper, prop, identity, range, compose} = require('ramda');
// Contravariant functors usually have this shape F(a -> ConcreteType).
// In other words, some type holding a function which is parametric on its input, but not output.
// They don't always have that shape, but it's a good intuition
// Covariant functors are what we're used to, which are parametric in their output
//================================================================
/**
* Based on
* https://github.com/donnut/typescript-ramda
* with the help of the typescript-converter from
* git@github.com:ptmt/flow-declarations.git
*/
declare module 'ramda' {
declare type placeholder = {}
declare type ListIterator<T, TResult> = {
(value: T, index: number, list: T[]): TResult;