Instantly share code, notes, and snippets.

View FList.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
module FList
( FList
) where
import GHC.Exts
View DeBruijn.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
module DeBruijn
( Expr(..)
, DBI(..)
, toDBI
) where
import Control.Applicative
View !wasmllvm.md

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
View Freer.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -Wall #-}
module Freer
( Freer
, liftFreer
, foldFreer
) where
View a.cpp
// beginning a Binaryen API trace
#include <math.h>
#include <map>
#include "src/binaryen-c.h"
int main() {
std::map<size_t, BinaryenFunctionTypeRef> functionTypes;
std::map<size_t, BinaryenExpressionRef> expressions;
std::map<size_t, BinaryenFunctionRef> functions;
std::map<size_t, BinaryenImportRef> imports;
std::map<size_t, BinaryenExportRef> exports;
View a.cpp
// beginning a Binaryen API trace
#include <math.h>
#include <map>
#include "src/binaryen-c.h"
int main() {
std::map<size_t, BinaryenFunctionTypeRef> functionTypes;
std::map<size_t, BinaryenExpressionRef> expressions;
std::map<size_t, BinaryenFunctionRef> functions;
std::map<size_t, BinaryenImportRef> imports;
std::map<size_t, BinaryenExportRef> exports;
View build.mk
SRC_HC_OPTS = -O -H64m
GhcStage1HcOpts = -O
GhcStage2HcOpts = -O2
GhcLibHcOpts = -O2
BUILD_PROF_LIBS = YES
SplitObjs = NO
SplitSections = YES
BUILD_SPHINX_HTML = YES
BUILD_SPHINX_PDF = NO
HADDOCK_DOCS = YES
View nvm-node-nightlies.md

You can install Node Nightlies/RCs via nvm using NVM_NODEJS_ORG_MIRROR environment variable.

Install latest Node RC

NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/rc/ nvm i node

Install latest Node.js Nightly

NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm i node
View Subst.hs
{-# LANGUAGE DataKinds, GADTs #-}
import Data.Data
data Phase
= PS
| PI
data Term a where
S :: String -> Term 'PS
View sea-of-blocks.cpp
#include <iostream>
#include <string>
#include <vector>
#include <binaryen-c.h>
static BinaryenExpressionRef build_sea_of_blocks(BinaryenModuleRef m,
int block_num) {
std::vector<std::string> labels;
labels.reserve(block_num);
std::vector<const char *> label_ptrs;