Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastian Graf sgraf812

View GitHub Profile
@sgraf812
sgraf812 / test.hs
Last active Mar 31, 2020
Specialising Arrowized FRP
View test.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE GADTs #-}
module Lib where
import Control.Arrow
import Control.Category
data Step s a = Yield !s a
View insync.nix
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";
View Tmp.hs
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 Jan 22, 2019
Circular module dependencies in D
View a.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 Jan 14, 2019
Late lambda lifting runtime, default vs. arbitary closure growth
View 1. ghc-8.6 baseline vs default llf
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 Jan 9, 2019
nofib ll ll-c2
View nofib
--------------------------------------------------------------------------------
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 Jan 4, 2019
cabal new-build error
View v3.log
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
View allow-cg 19 +RTS -S -G1
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 Mar 29, 2018
Reproduction for GHC ticket #8763
View repro.hs
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 #-}
View stream-fusion.head-simpl
==================== 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
You can’t perform that action at this time.