Here's an ADT which is not a GADT, in Haskell:
data Expr = IntExpr Int | BoolExpr Bool| -- | Simple alias for PostgreSQL connection pools. | |
| type PostgresPool = Pool.Pool PGS.Connection | |
| -- | Execute a query against the PostgreSQL database, using | |
| -- a connection pool. | |
| runQueryPool :: Default QueryRunner cols vals | |
| => Pool.Pool PGS.Connection | |
| -> Query cols | |
| -> IO [vals] | |
| runQueryPool p q = Pool.withResource p (`runQuery` q) |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
| { | |
| // http://eslint.org/docs/rules/ | |
| "ecmaFeatures": { | |
| "binaryLiterals": false, // enable binary literals | |
| "blockBindings": false, // enable let and const (aka block bindings) | |
| "defaultParams": false, // enable default function parameters | |
| "forOf": false, // enable for-of loops | |
| "generators": false, // enable generators | |
| "objectLiteralComputedProperties": false, // enable computed object literal property names |
| var cloneWithProps = React.addons.cloneWithProps; | |
| var SmartSortable = React.createClass({ | |
| getDefaultProps: function() { | |
| return {component: "ul", childComponent: "li"}; | |
| }, | |
| render: function() { | |
| var props = jQuery.extend({}, this.props); |
| #!/usr/bin/env ruby | |
| # Script by Eric Mill to detect government domains in the Chrome HSTS Preload list. | |
| # | |
| # The Chrome HSTS Preload list is a hardcoded set of domains for which the browser | |
| # will *only* ever access the site using HTTPS. If an http:// link to that site is | |
| # encountered, the browser will just rewrite the URL to https:// before following | |
| # it. | |
| # | |
| # This list is also incorporated into Firefox and Safari, making it a nice list to |
| import json | |
| import urlparse | |
| from itertools import chain | |
| flatten = chain.from_iterable | |
| from nltk import word_tokenize | |
| from gensim.corpora import Dictionary | |
| from gensim.models.ldamodel import LdaModel | |
| from gensim.models.tfidfmodel import TfidfModel |
| module FizzBuzzC | |
| %default total | |
| -- Dependently typed FizzBuzz, constructively | |
| -- A number is fizzy if it is evenly divisible by 3 | |
| data Fizzy : Nat -> Type where | |
| ZeroFizzy : Fizzy 0 | |
| Fizz : Fizzy n -> Fizzy (3 + n) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| (function() { | |
| // Do not use this library. This is just a fun example to prove a | |
| // point. | |
| var Bloop = window.Bloop = {}; | |
| var mountId = 0; | |
| function newMountId() { | |
| return mountId++; | |
| } |