Skip to content

Instantly share code, notes, and snippets.

@mpickering
mpickering / gist:99d62ccdb73f49840220
Last active August 4, 2016 01:05
Native idiom brackets
-- https://wiki.haskell.org/Idiom_brackets
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, FlexibleInstances, UndecidableInstances #-}
import Control.Applicative
import Control.Monad.Identity
class Applicative i => Idiomatic i f g | g -> f i where
idiomatic :: i f -> g
iI :: Idiomatic i f g => f -> g
@chrisdone
chrisdone / typing.md
Last active March 22, 2025 09:05
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@philandstuff
philandstuff / codemesh2014.org
Last active July 5, 2022 13:29
Code Mesh 2014

Codemesh 2014, London

keynote: complexity is outside the code

when I started programming:

  • architecture was always:
    • box - box - cylinder
  • then layers:
    • ideally:
@ei-grad
ei-grad / rotate.py
Last active March 17, 2020 19:03
Rotate screen on tablet PCs
#!/usr/bin/env python
from time import sleep
from os import path as op
import sys
from subprocess import check_call, check_output
from glob import glob
def bdopen(fname):
@david-christiansen
david-christiansen / Dep.scala
Created August 20, 2014 20:19
Simple presentation of singletons in Scala
package dep
import scala.language._
object Dep extends App {
sealed trait Nat {
type Plus[M <: Nat] <: Nat
def plus[M <: Nat](m: M): Plus[M]
}
package net.arya.util.nice_range
/**
* Supports ranges and increments of things that aren't numbers.
* Example usage at the end.
* Created by arya on 8/4/14.
*/
/** Syntax for constructing Ranges: start upTo end */
object syntax {
import org.scalacheck._
import org.scalatest._
import org.scalatest.prop.GeneratorDrivenPropertyChecks
class SubsetGenerator(set: String*) {
protected val subsets = set.toSet.subsets.toSeq
val arbitrarySubsetGen: Gen[Set[String]] = for {
subset <- Gen.oneOf(subsets)
@rubo77
rubo77 / rotate-screen.sh
Last active October 9, 2023 11:30
This script rotates the screen and touchscreen input, disables or enbles the touchpad, and dis- or enables the virtual keyboard on a Lenovo Yoga 13 or Yoga 2 Pro (source: http://askubuntu.com/q/405628/34298)
#!/bin/bash
# This script rotates the screen and touchscreen input 90 degrees each time it is called,
# also disables the touchpad, and enables the virtual keyboard accordingly
# by Ruben Barkow: https://gist.github.com/rubo77/daa262e0229f6e398766
#### configuration
# find your Touchscreen and Touchpad device with `xinput`
TouchscreenDevice='ELAN Touchscreen'
TouchpadDevice='SynPS/2 Synaptics TouchPad'
@hallettj
hallettj / Cat.lidr
Last active April 2, 2018 15:05
description of category laws in Idris
# Category Theory proofs in Idris
Idris is a language with dependent types, and is similar to Agda.
What distinguishes Idris is that it is intended to be a general-purpose language first,
and a theorem prover second.
To that end it supports optional totality checking
and features to support writing DSLs:
type classes,
do notation,
monad comprehensions (i.e., a more general form of list comprehension),
@jdegoes
jdegoes / RedEyesPreview.scala
Created February 4, 2014 17:20
A preview of the RedEyes web framework
/*
* RedEyes generates rich descriptions of the API, as well as valid examples for
* all parameters (in this case, example header, query parameter, and content).
*
* The API can also be used to generate client libraries in a variety of languages.
*
* Service handlers are strongly-typed (e.g. retrieveEmployees expects an integer
* and a ModelDesc). Any errors in using the API automatically generate rich
* descriptions on what was expected.
*/