- In type theory a Product type is a type made of a set of types compounded over each other. In Haskell we represent products using tuples or data constructors with more than one argument. The “compounding” is from each type argument to the data constructor representing a value that coexists with all the other values simultaneously. Products of types represent a conjunc- tion, “and,” of those types. If you have a product of Bool and Int, your terms will each contain a Bool and Int value.
- In type theory a Sum type of two types is a type whose terms are terms in either type, but not simultaneously. In Haskell sum types are represented using the pipe, |, in a datatype definition. Sums of types represent a disjunction, “or,” of those types. If you have a sum of Bool and Int, your terms will be either a Bool value or an Int value.
This file contains 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 { DataTypes } = require('sequelize') | |
module.exports = { | |
schema: { | |
id: { | |
type: DataTypes.INTEGER, | |
primaryKey: true, | |
allowNull: false, | |
autoIncrement: true, | |
}, |
This file contains 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
window.audioContext = window.audioContext||window.webkitAudioContext; //fallback for older chrome browsers | |
var context = new AudioContext(); | |
context.createGain = context.createGain||context.createGainNode; //fallback for gain naming | |
var gainL = context.createGain(); | |
var gainR = context.createGain(); | |
var splitter = this.context.createChannelSplitter(2); | |
//Connect to source |
This file contains 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
import React, { Component, PropTypes } from 'react' | |
import { Table, Menu, Icon, Segment, Input } from 'semantic-ui-react' | |
class TableElement extends React.Component { | |
constructor(props) { | |
super(props); | |
this.data = props.data | |
this.renderRow = props.renderBodyRow || this.defaultRenderBodyRow | |
this.headerRow = props.headers || Object.keys(this.data.pop()); | |
this.currentIndex = 0 |
This file contains 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
import * as React from 'react'; | |
import * as hash from 'object-hash'; | |
import { | |
TableProps, | |
Table, | |
TableBody, | |
TableCell, | |
TableFooter, | |
TableHeaderCell, |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains 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
PROGRAMMING WITH EFFECTS | |
Graham Hutton, January 2015 | |
Shall we be pure or impure? | |
The functional programming community divides into two camps: | |
o "Pure" languages, such as Haskell, are based directly | |
upon the mathematical notion of a function as a | |
mapping from arguments to results. |
haskell (its kind of pseudo-code)
data Person = Person String String
liftA2 Person (Just "George") (Just "Martin")
-- is same as
Person <$> (Just "George") <*> (Just "Martin")
-- evaluation steps:
Just (\surname -> Person "George" surname) <*> (Just "Martin")
Just (Person "George" "Martin")
This file contains 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
import Validation, { Success, Failure } from 'data.validation' | |
// დატა ფილდები ინტელისენსისთვის | |
interface Validator<T, V> { | |
criteria: T, | |
fieldName: String, | |
value: V, | |
result(): Validation, | |
} |
This file contains 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 gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var babelify = require('babelify'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var uglify = require('gulp-uglify'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var livereload = require('gulp-livereload'); |