This file contains hidden or 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
//Some fantasy implementations | |
const Just = require('./just') | |
const Cant = require('./cant') | |
const List = require('./list') | |
//Spec file that defines what arguments are used for type identification | |
const fantasy = require('./fantasy') | |
//The magic. | |
const {chain, map, index} = require('../../src/xface')(fantasy, [Just, Cant]) |
This file contains hidden or 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
var Maybe = require('./maybe.js') | |
var List = require('./list.js') | |
//Pass fantasy implementations to it | |
var {concat, map} = require('fantasy')({Maybe, List}) | |
mapDouble = map(a => 2 * a) | |
mapDouble([1, 2]) | |
//[2, 4] |
This file contains hidden or 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
/* eslint-disable new-cap */ | |
/** | |
* Lens types. | |
* =========== | |
* | |
* a * b = {fst: a, snd: b} | |
* a + b = {index: Boolean, value: a | b} | |
* | |
* Iso s t a b = forall (~>) . Profunctor (~>) => (a ~> b) -> (s ~> t) |
This file contains hidden or 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
/// PRELIMINARIES | |
/** | |
* Generalized "products" of any size. For gluing things together. A tuple is a | |
* "2"-meet. | |
* | |
* The type `Meet a b c d ...` indicates a `Meet` of the given size with values | |
* at each type in the sequence. | |
*/ |
This file contains hidden or 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
var R = require('ramda'); | |
var Future = require('ramda-fantasy').Future; | |
//Wrap ajax in a future | |
//:: String -> Future String | |
var fetch = function(url) { | |
return new Future(function(rej, res){ | |
var oReq = new XMLHttpRequest(); | |
oReq.addEventListener("load", res, false); | |
oReq.addEventListener("error", rej, false); | |
oReq.addEventListener("abort", rej, false); |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Browse Ramda documentation in Terminal | |
# Requires jq and a tool such as fzf or peco for interactive filtering | |
LATEST="http://raine.github.io/ramda-json-docs/latest.json" | |
DOCS_URL="http://ramdajs.com/docs/" | |
json=$(curl -s $LATEST) | |
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end') |
This file contains hidden or 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
hush :: Either e a -> Maybe a | |
hush = either (const Nothing) Just | |
toId :: JObject -> Maybe Number | |
toId o = fromNumber <|> fromString | |
where | |
fromNumber = hush $ o .? "id" | |
fromString = do | |
s <- hush $ o .? "id" | |
mfilter (isNan >>> not) Just (readFloat s) |
This file contains hidden or 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
; The official HD AI | |
; An Artificial Intelligence Script written by Archon and Promiskuitiv | |
; Get in contact with Promiskuitiv by sending a mail to [email protected] | |
; List of taunts it reacts to: | |
; Standard taunts. | |
; 33 - Stop slinging resources. If slinging is requested early and is immediately canceled it may mess up the strategy. | |
; 38 - Sling Resources. Human player only, stops any unit production except for civilian units. |
This file contains hidden or 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
wget http://download.virtualbox.org/virtualbox/4.3.12/VBoxGuestAdditions_4.3.12.iso | |
sudo mkdir /media/iso | |
sudo mount -o loop ./VBoxGuestAdditions_4.3.12.iso /media/iso | |
sudo bash /media/iso/VBoxLinuxAdditions.run --nox11 | |
sudo umount /media/iso |
This file contains hidden or 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
var Option = require('fantasy-options') | |
var Some = Option.Some; | |
var None = Option.None; | |
var Compose = function(x){ | |
this.val = x; | |
} | |
Compose.prototype.map = function(f){ | |
return new Compose(this.val.map(function(u){return u.map(f); })); |