Skip to content

Instantly share code, notes, and snippets.

View alexbiehl's full-sized avatar

Alexander Biehl alexbiehl

  • Freelancer
  • Hamburg, Germany
View GitHub Profile

Keybase proof

I hereby claim:

  • I am alexbiehl on github.
  • I am alexbiehl (https://keybase.io/alexbiehl) on keybase.
  • I have a public key ASBJWO927tPGNk_etl8OJS_t5-4UiLbt6CciWkMBLFOM5Ao

To claim this, I am signing this object:

{-# LANGUAGE TypeApplications, UndecidableInstances, ConstraintKinds, ExistentialQuantification, DataKinds, ScopedTypeVariables, TypeFamilies, TypeOperators #-}
module Rights where
import Data.Kind
import Data.List
import Data.Coerce
import Data.Proxy
import GHC.TypeLits
type Policy = State -> State
type Demand = State -> State
type Observation = (Demand, State)
eval :: State -> Policies -> Demands -> [State]
eval = ...
observations :: State -> State -> [Observation]
@alexbiehl
alexbiehl / FVs.hs
Last active November 13, 2017 10:02
data FvLoad = FvOff !ByteOff
| FvInd (NonVoid Id) !DynTag !ByteOff
-- | The free variable info of the outer closure
data FreeVarInfo = MkFreeVarInfo {
fvInfoBndr :: NonVoid Id
-- ^ the outer closures binder
, fvInfoBndrTag :: !DynTag
@alexbiehl
alexbiehl / Bug.hsig
Created November 8, 2017 11:36
cabal backpack bug
signature Bug where
bug :: String
-- Initial ignite.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: bug
version: 0.1.0.0
-- synopsis:
-- description:
license: BSD3
license-file: LICENSE
author: alexbiehl

Regions

Basically Immix organizes the heap into "regions":

  • Coarse grained blocks, usually 32k in size (GHC also uses 32k for block size currently)
  • blocks are divided into lines, 128b in size

Objects may span lines but no blocks. The idea is to reclaim memory on line and block level instead of per object.

  • A line is considered free if it does not contain any live object.
  • A block is considered free if it does not contain any live line.
clunky env var1 var2 | ok1 && ok2 = val1 + val2
| otherwise = var1 + var2
where
m1 = lookup env var1
m2 = lookup env var2
ok1 = maybeToBool m1
ok2 = maybeToBool m2
val1 = expectJust m1
function(toggle) {
var trigger = document.getElementById('quickjump-trigger');
if (trigger) {
trigger.onclick = function(e) { e.preventDefault(); toggle(); };
}
}
{-# LANGUAGE BangPatterns #-}
module TimerManagerBench where
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.State.Strict
import Data.Foldable
import GHC.Event
import System.Random
import Control.Concurrent