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
data Expr = Var String | |
| Val Int | |
| Add Expr Expr | |
| Let (List (String, Int)) Expr | |
data Eval : Type -> Type where | |
MkEval : (List (String, Int) -> Maybe a) -> Eval a | |
fetch : String -> Eval Int | |
fetch x = MkEval (\e => fetchVal e) where |
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
module queue | |
import Data.Vect | |
-- Here's the port of the Liquid Haskell blog post on amortized | |
-- queues. The tricksy bit is that the "amortized" bit depends on | |
-- laziness. This means that while in the REPL (where Idris is lazy) | |
-- this is reasonably efficient. It compiles absolutely horribly | |
-- though because each time push or pop something we rotate the whole | |
-- damned thing. |
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
object STRef { | |
/** | |
* Here is a container where we have a single "state thread" = ST. | |
* When we run this thread of type ST[T] we get a result of type T. | |
*/ | |
sealed abstract class ST[+T] { | |
def map[R](fn: T => R): ST[R] = flatMap(t => Const(fn(t))) | |
def flatMap[R](fn: T => ST[R]): ST[R] = FlatMapped(this, fn) | |
} |
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
%%% led_controller is a module to toggle LEDs wired to gpio pins on the raspberry pi | |
-module(led_controller). | |
-behavior(gen_server). | |
-export([start_link/1]). | |
% standard gen_server | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
% Public Interface | |
-export([on/1, off/1, blink/2]). | |
% Don't call these directly | |
-export([blink_cast/2]). |
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
module Main | |
{- | |
Compile with: | |
idris --package javascript --target javascript test.idr -o test.js | |
<html> | |
<head> |
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
function go_(machine, step) { | |
while(!step.done) { | |
try { | |
var arr = step(), | |
state = arr[0], | |
value = arr[1]; | |
switch (state) { | |
case "park": | |
setImmediate(function() { go_(machine, step); }); |
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 GADTs #-} | |
module Homomorphisms where | |
import Control.Monad | |
import Control.Applicative | |
import Data.Monoid hiding (Endo) | |
import qualified Control.Category as C |
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
Hello, my name ist {{name}} and I am {{age}} years old. |
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 RebindableSyntax, | |
KindSignatures, | |
DataKinds, | |
GADTs, | |
GeneralizedNewtypeDeriving, | |
StandaloneDeriving, | |
FlexibleInstances, | |
Rank2Types #-} | |
module Connection ( |
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 fs = require('fs'); | |
var path = require('path'); | |
var sweet = require('sweet.js'); | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
sweetjs: { | |
options: { | |
modules: ['es6-macros'], | |
sourceMap: true, |
OlderNewer