Here's an ADT which is not a GADT, in Haskell:
data Expr = IntExpr Int | BoolExpr Bool
defmodule MyApp.Client do | |
@moduledoc """ | |
Generic client wrapper for an API service. Pass in an adapter like HTTPoison. | |
""" | |
alias MyApp.Service # API credentials struct | |
def build_url(path, %Service{url: url, auth: %{}}), do: append(url, "/") <> path | |
def build_url(path, queries, service) do | |
query_params = URI.encode_query(queries) | |
build_url(path, service) <> "?" <> query_params |
package nl.mdj | |
import scala.concurrent.duration._ | |
import scala.concurrent.{Await, Future} | |
import scala.util.{Failure, Success, Try} | |
import scalaz.Scalaz._ | |
import scalaz._ | |
object Transformers extends App { |
import shapeless._ | |
import scalaz._ | |
import Scalaz._ | |
object console extends App { | |
trait Foo[A] { | |
type B | |
def value: B |
val sqlContext = new org.apache.spark.sql.SQLContext(sc) // optional | |
val df = sqlContext.load("jdbc", Map( | |
"url" -> "jdbc:mysql://<ip.address.your.db>/<table>?user=<username>&password=<pwd>", | |
"dbtable" -> "<tablename>")) | |
df.select("<col1>","<col2>","<col3>").save("</path/to/parquet/file.parquet>","parquet") | |
//Alternatively, to save all the columns: |
# Assume we are in your home directory | |
cd ~/ | |
# Clone the repo from GitLab using the `--mirror` option | |
$ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git | |
# Change into newly created repo directory | |
$ cd ~/my-repo.git | |
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks. |
(Chapters marked with * are already written. This gets reorganized constantly | |
and 10 or so written chapters that I'm on the fence about aren't listed.) | |
Programmer Epistemology | |
* Dispersed Cost vs. Reduced Cost | |
* Verificationist Fallacy | |
* Mistake Metastasis | |
The Overton Window | |
Epicycles All The Way Down | |
The Hyperspace Gates Were Just There |
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)