Skip to content

Instantly share code, notes, and snippets.

View cartazio's full-sized avatar

Carter Tazio Schonwald cartazio

View GitHub Profile
@thoughtpolice
thoughtpolice / demo.txt
Last active March 28, 2018 11:37
Transactional memory on Haswell
/* -------------------------------------------------------------------------- */
gen2 Core i5 (Sandy Bridge):
$ clang -cc1 -version
LLVM (http://llvm.org/):
LLVM version 3.4svn
Optimized build.
Built Oct 13 2013 (18:10:38).
Default target: x86_64-unknown-linux-gnu
Host CPU: corei7-avx
@stbuehler
stbuehler / hackage-upload-docs.sh
Last active October 6, 2017 22:48
Generate and upload docs for hackage packages
#!/bin/bash
# Options / Usage
# put this script in the same directory as your *.cabal file
# it will use the first line of "cabal info ." to determine the package name
# custom options for "cabal haddock" (cabal haddock --help,
# http://www.haskell.org/haddock/doc/html/invoking.html)
CUSTOM_OPTIONS=(--haddock-options='-q aliased')
# hackage server to upload to (and to search uploaded versions for)
@goldfirere
goldfirere / Shape-7.6.hs
Last active December 25, 2015 02:29
Strongly-typed version of code from GHC Trac #8423.
{-# LANGUAGE DataKinds, PolyKinds, GADTs, TypeFamilies, TypeOperators,
ConstraintKinds, ScopedTypeVariables, RankNTypes #-}
module Shape where
import GHC.Exts
data a :=: b where
Refl :: a :=: a
@copumpkin
copumpkin / UnboxableSums.hs
Last active December 24, 2015 19:19
Unboxable sigmas à la (unimplemented) Kmett, based on "unzipping" with a rank datastructure (currently super shitty). Please excuse the crap quality of the code, but I was just banging out ideas.
{-# LANGUAGE TypeFamilies, GADTs, ConstraintKinds, RankNTypes, TypeOperators, ScopedTypeVariables, FlexibleInstances, FlexibleContexts, MultiParamTypeClasses #-}
module UnboxableSums where
import Prelude hiding (lookup)
import Data.Word
import Data.Bits
import Data.Maybe
import Data.Function
import Data.Constraint
import qualified Data.Vector as V
#include <iostream>
#include <intrin.h>
#include <deque>
#include <numeric>
#include <thread>
using namespace std;
void test (void(*f)()) {
deque<unsigned long long> times;
.cabal-sandbox/
dist/
cabal.config
cabal.sandbox.config
.*.swp
@copumpkin
copumpkin / Mutable.hs
Last active December 23, 2015 14:09
Mutable buffered Iteratee-like things. Goal is to let me reuse the input "chunks" but to prevent users from hanging onto them and seeing data they shouldn't see. Does it work? You can leak the MVector reference in an existential but then you can't do anything with it, right?
{-# LANGUAGE RankNTypes, BangPatterns #-}
module Mutable where
import Control.Monad
import Control.Monad.ST
import Data.STRef
import Data.Vector.Mutable (MVector)
import qualified Data.Vector.Mutable as MV
-- A read-only view into an MVector or similar
@dysinger
dysinger / Git.hs
Created September 19, 2013 23:10
{-# LANGUAGE OverloadedStrings #-}
module Git where
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as T
import Prelude hiding (FilePath)
import Shelly
git :: [Text] -> Sh Text
{-# LANGUAGE KindSignatures #-}
import Bound.Class
{-
What laws should Bound have?
We need at least enough to make sure the typical Monad Exp instances are valid.
Let's start by writing some generic Bound instances.
fficxx issues:
1. simpleBuilder hard coded snappy specific code. -- Patched but not tested
2. resource management issue in C shim code(returned objects and references are converted to pointers, then use ForeignPtr on the Haskell), this probably will cause a critical bug.
3. fficxx currently doesn't deal with global variables
4. Multiple packages for one C++ project
5. enumeration and class support is not implemented (in swig branch)
6. interface to C++ in the C shim code is not fully implemented
7. need to support function pointers
8. finish top-level functions