Skip to content

Instantly share code, notes, and snippets.

@mikusp
mikusp / a.hs
Last active February 19, 2018 06:59
PoC calling dynamic C functions in Haskell
{-# OPTIONS_GHC -ddump-simpl -ddump-stg -ddump-asm -ddump-cmm -ddump-opt-cmm -ddump-to-file #-}
{-# LANGUAGE GHCForeignImportPrim, UnliftedFFITypes, MagicHash, UnboxedTuples, RecursiveDo, GeneralizedNewtypeDeriving, BangPatterns #-}
module Main where
import Data.Coerce
import Foreign
import Foreign.C.String
import qualified System.Posix.DynamicLinker as DL
import qualified System.Posix.Signals as Sig
import qualified Control.Concurrent.Async as Async
@mikusp
mikusp / log
Created September 25, 2016 14:09
GHC 8.0.1 registered AArch64 testsuite log
This file has been truncated, but you can view the full file.
make -C testsuite/tests CLEANUP=1 SUMMARY_FILE=../../testsuite_summary.txt
make[1]: Entering directory '/home/alarm/clean_builds/ghc-8.0.1/testsuite/tests'
python2 ../driver/runtests.py -e ghc_compiler_always_flags="'-fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -fshow-warning-groups -no-user-package-db -rtsopts -fno-warn-tabs -fno-warn-missed-specialisations'" -e ghc_debugged=False -e ghc_with_native_codegen=0 -e ghc_with_vanilla=1 -e ghc_with_dynamic=1 -e ghc_with_profiling=1 -e ghc_with_threaded_rts=1 -e ghc_with_dynamic_rts=1 -e ghc_with_interpreter=1 -e ghc_unregisterised=0 -e ghc_dynamic_by_default=False -e ghc_dynamic=True -e ghc_with_smp=1 -e ghc_with_llvm=1 -e windows=False -e darwin=False -e in_tree_compiler=True -e clean_only=False --rootdir=. --configfile=../config/ghc -e 'config.confdir="../config"' -e 'config.platform="aarch64-unknown-linux"' -e 'config.os="linux"' -e 'config.arch="aarch64"' -e 'config.wordsize="64"' -e 'default_testopts.cleanup="1"' -e 'config.timeout=int() or confi
This file has been truncated, but you can view the full file.
abakus
abakusa
abakusach
abakusami
abakusem
abakusie
abakusom
abakusowi
abakusów
abakusy
/* -----------------------------------------------------------------------------
*
* Module : Function
* Copyright : [2008..2014] Manuel M T Chakravarty, Gabriele Keller
* [2009..2014] Trevor L. McDonell
* License : BSD3
*
* Maintainer : Trevor L. McDonell <tmcdonell@cse.unsw.edu.au>
* Stability : experimental
*
@mikusp
mikusp / cq.c
Created January 9, 2014 15:26
Constant Q transform implemented in C using FFTW and custom build of CXSparse from SuiteSparse. Based on a MATLAB implementation presented in http://doc.ml.tu-berlin.de/bbci/material/publications/Bla_constQ.pdf .
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include "../../cxsparse/Include/cs.h"
#include <fftw3.h>
float* cq_hanning_window(int length) {
float* result = fftwf_alloc_real(length);
@mikusp
mikusp / hanoi.cpp
Created November 10, 2013 21:04
Frame-Stewart algorithm C++11 implementation
#include <iostream>
#include <tuple>
#include <stack>
#include <vector>
std::stack<int> to132(std::stack<int> s) {
int first = s.top();
s.pop();
int second = s.top();
s.pop();
@mikusp
mikusp / a.hs
Last active December 24, 2015 02:09
{-# LANGUAGE MagicHash, RecordWildCards #-}
import qualified Data.Map as Map
import Data.List
import Data.Maybe
main = print $ recognize chords [F#,B,D#,A,E]
{-- types --}
type Interval = Int