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
#!/usr/bin/env perl | |
use v5.14; | |
use strict; | |
use warnings; | |
use File::KeePass; | |
use Text::CSV; | |
use Data::Dump qw(pp); | |
use Term::ReadPassword; |
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
{-# LANGUAGE RankNTypes #-} | |
data F f = F { | |
_map :: forall a b. (a -> b) -> f a -> f b | |
} | |
data Mu f a | |
= Term { retract :: a } | |
| Cont (f (Mu f a)) |
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
{- | THIS HAS MOVED | |
- | |
- https://github.com/gatlin/FreeStream | |
-} |
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
Type operators! | |
=== | |
Turns out a GHC language extension makes a lot of cool things possible that I | |
think you hinted at: | |
> {-# LANGUAGE TypeOperators #-} | |
> data a + b = Inl a | Inr b deriving Show |
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
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE ExistentialQuantification #-} |
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 getId = function() { | |
var _id = 0; | |
return function() { | |
return _id++; | |
} | |
}() | |
// usage | |
console.log(getId()); |
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
/*** | |
* Fun with closures! | |
* | |
* Run this with node.js: | |
* | |
* $> node closurewanking.js | |
*/ | |
var http = require('http'); |
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
#lang racket | |
(require db) | |
(require "utils.rkt") | |
; open a connection to our database | |
(define (call-with-conn db proc) | |
(let ([conn (sqlite3-connect #:database db | |
#:mode 'read/write)]) | |
(proc conn))) |
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
#lang racket | |
;; Wherein we define a prototypal object system | |
; A λ-function which abstracts the basic operations one can perform on an "object": | |
; - getting a property | |
; - setting a property | |
; - yielding its state | |
; - replacing its state | |
(define (make-object state) |
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
#lang typed/racket | |
(define-syntax (= stx) | |
(syntax-case stx () | |
[(= sym expr) | |
#'(define sym expr)] | |
[(= sym (arg ...) expr) | |
#'(define (sym arg ...) expr)])) | |
;; example usage |