Skip to content

Instantly share code, notes, and snippets.

View sgraf812's full-sized avatar

Sebastian Graf sgraf812

  • Karlsruhe, Germany
View GitHub Profile
@sgraf812
sgraf812 / test.hs
Last active March 31, 2020 22:02
Specialising Arrowized FRP
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE GADTs #-}
module Lib where
import Control.Arrow
import Control.Category
data Step s a = Yield !s a
@sgraf812
sgraf812 / insync.nix
Created November 14, 2019 09:02
insync
self: super:
{
insync = super.insync.overrideAttrs (old: rec {
version = "3.0.23.40579";
src = let dist = "stretch"; in
if self.stdenv.hostPlatform.system == "x86_64-linux" then
self.fetchurl {
url = "http://s.insynchq.com/builds/${old.pname}_${version}-${dist}_amd64.deb";
@sgraf812
sgraf812 / Tmp.hs
Created November 8, 2019 13:20
etaReaderT
module Tmp where
import Control.Monad.Reader
import GHC.Exts
r :: Int -> Reader Int Int
r x = case sum [0..x] of n -> (+ n) <$> ask
etaReaderT :: Reader r a -> Reader r a
etaReaderT = ReaderT . oneShot . runReaderT
@sgraf812
sgraf812 / a.d
Created January 22, 2019 09:54
Circular module dependencies in D
module a;
import b;
import std.stdio;
struct Flip { Flop* p; }
auto flip(int i) {
if (i == 0) return null;
auto f = new Flip;
@sgraf812
sgraf812 / 1. ghc-8.6 baseline vs default llf
Last active January 14, 2019 09:27
Late lambda lifting runtime, default vs. arbitary closure growth
NoFib Results
--------------------------------------------------------------------------------
Program Allocs Runtime
--------------------------------------------------------------------------------
anna -1.7% -0.3%
ansi 0.0% +0.5%
atom -0.7% -3.8%
awards -0.2% +2.4%
banner 0.0% -0.1%
@sgraf812
sgraf812 / nofib
Created January 9, 2019 16:19
nofib ll ll-c2
--------------------------------------------------------------------------------
Program Allocs Allocs Instrs Instrs
ll-2019-0 ll-c2-201 ll-2019-0 ll-c2-201
--------------------------------------------------------------------------------
anna -1.5% -2.2% -0.5% -0.8%
ansi -0.0% +0.0% -0.0% -0.1%
atom -0.7% -0.7% -0.9% -0.5%
awards -0.2% -0.2% -0.1% -2.0%
banner -0.0% -0.7% +0.0% -0.2%
bernouilli -0.0% -0.0% -0.0% -0.0%
@sgraf812
sgraf812 / v3.log
Created January 4, 2019 17:50
cabal new-build error
File monitor 'config' unchanged.
this build was affected by the following (project) config files:
File monitor 'improved-plan' unchanged.
PreExisting Cabal-2.0.1.0 (Cabal-2.0.1.0)
array-0.5.2.0
base-4.10.1.0
bytestring-0.10.8.2
containers-0.5.10.2
deepseq-1.4.3.0
filepath-1.4.1.2
Alloc Copied Live GC GC TOT TOT Page Flts
bytes bytes bytes user elap user elap
1056408 530192 554864 0.001 0.001 0.002 0.002 0 0 (Gen: 0)
1062312 1104912 1129584 0.002 0.002 0.005 0.005 0 0 (Gen: 0)
2214632 2318568 2343240 0.005 0.005 0.010 0.010 0 0 (Gen: 0)
4664072 4901704 4926376 0.005 0.005 0.018 0.018 0 0 (Gen: 0)
10024760 10441000 10465672 0.012 0.012 0.032 0.032 0 0 (Gen: 0)
20993672 21820424 21845096 0.026 0.026 0.064 0.064 0 0 (Gen: 0)
43917640 46083608 46108280 0.049 0.049 0.123 0.123 0 0 (Gen: 0)
92685040 97687520 97712192 0.109 0.109 0.260 0.260 0 0 (Gen: 0)
@sgraf812
sgraf812 / repro.hs
Created March 29, 2018 20:25
Reproduction for GHC ticket #8763
module Main (main) where
import System.Environment (getArgs)
import Control.Monad (when, forM_)
import GHC.ST
nop :: Monad m => a -> m ()
nop _ = return ()
{-# NOINLINE nop #-}
==================== Tidy Core ====================
2018-02-23 13:10:24.831160667 UTC
Result size of Tidy Core
= {terms: 763, types: 933, coercions: 17, joins: 10/34}
-- RHS size: {terms: 13, types: 16, coercions: 0, joins: 0/0}
Main.$WMkStream [InlPrag=INLINE[2]]
:: forall a s. (s -> Step s a) -> s -> Stream a