> const curry = require('./curry')
> const add3 = (a, b, c) => a + b + c
> add3(1, 2, 3)
6
> const curAdd3 = curry(add3)
> curAdd3(1)
[Function]
> curAdd3(1, 2)
[Function]
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
| module Functor | |
| ( Functor | |
| , lift | |
| , apply | |
| , map | |
| , Monad | |
| , join | |
| , flatMap | |
| , Maybe(..) |
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
| const URL = require('url') | |
| const QS = require('qs') | |
| const { createElement } = require('react') | |
| const { renderToString } = require('react-dom/server') | |
| const { createServer } = require('http') | |
| const logger = require('connect-logger') | |
| const connect = require('connect') | |
| const components = require('./components') |
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
| .envrc |
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
| module Main where | |
| import System.IO | |
| import Control.Concurrent | |
| import Control.Concurrent.STM | |
| type Error = String | |
| data Payload | |
| = Increment |
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
| const flatMap = (array, func) => ( | |
| array.reduce((result, element) => ( | |
| result.concat(func(element)) | |
| ), []) | |
| ) |
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
| const { assign } = Object | |
| const mergeResults = (pipeline, step) => ( | |
| pipeline.then((context) => ( | |
| step(context).then((result) => ( | |
| assign({}, context, result) | |
| )) | |
| )) | |
| ) |
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
| const { keys, assign } = Object | |
| const exampleSource = { | |
| first_name: 'Bob', | |
| last_name: 'Boberson', | |
| charity_1: '1', | |
| charity_2: '2', | |
| charity_3: '3' | |
| } |
A module which represents part of a Reaat app could export an array of routes and a reducer.
export {default as routes} from './routes'
export {default as reducer} from './store/reducer'
The top level application can take these exports and collect them together into the root routes def and the root reducer.
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
| const fetch = require('node-fetch') | |
| const Task = require('data.task') | |
| const KEY = 'KEY!' | |
| const asteroidRequest = new Task((reject, resolve) => ( | |
| fetch(`https://api.nasa.gov/neo/rest/v1/feed?start_date=2016-05-05&end_date=2016-05-05&api_key=${KEY}`) | |
| .then((res) => res.json()) | |
| .then(resolve) | |
| .catch(reject) |