Skip to content

Instantly share code, notes, and snippets.

View tibbe's full-sized avatar

Johan Tibell tibbe

View GitHub Profile
Full Data.HashMap.Base 361 739926 0.2 0.5 0.4 0.9
Leaf-coll Data.HashMap.Base 368 101 0.0 0.0 0.0 0.0
BitmapIndexed-replace Data.HashMap.Base 364 226745 0.1 0.1 0.1 0.2
Leaf-coll Data.HashMap.Base 367 87870 0.0 0.0 0.0 0.0
BitmapIndexed-grow Data.HashMap.Base 366 25452 0.0 0.0 0.0 0.0
Leaf-no-coll Data.HashMap.Base 365 81709 0.0 0.1 0.0 0.1
Leaf-no-coll Data.HashMap.Base 363 6060 0.0 0.0 0.0 0.0
BitmapIndexed-grow Data.HashMap.Base 362 203515 0.1 0.1 0.1 0.1
BitmapIndexed-replace Data.HashMap
# One time setup for hacking on cabal-install
git clone https://github.com/haskell/cabal.git
cd cabal/cabal-install
cabal sandbox init
cabal sandbox add-source ../Cabal
cabal install --only-dep
# Iterate
cabal build
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
module Test where
import GHC.Exts
add :: MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #)
add mba ix n s = fetchAddIntArray# mba ix n s
nand :: MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #)
./accelerate-0.14.0.0/Data/Array/Accelerate/Array/Data.hs:43:import GHC.Prim (newPinnedByteArray#, byteArrayContents#,
./accelerate-0.14.0.0/Data/Array/Accelerate/Array/Data.hs:631:uArrayPtr (UArray _ _ _ ba) = Ptr (byteArrayContents# ba)
./accelerate-0.14.0.0/Data/Array/Accelerate/Array/Data.hs:641: (# s', ba #) -> (# s', Ptr (byteArrayContents# ba) #)
./ajhc-0.8.0.10/src/RawFiles.hs:60: \ case action (byteArrayContents# barr#) s of { (# s, r #) ->\n\
./base-4.7.0.0/Foreign/Marshal/Alloc.hs:124: let addr = Ptr (byteArrayContents# barr#) in
./base-4.7.0.0/Foreign/Marshal/Alloc.hs:135: let addr = Ptr (byteArrayContents# barr#) in
./base-4.7.0.0/GHC/Conc/Windows.hs:99: asyncRead fd isSock len ((Ptr (byteArrayContents# (unsafeCoerce# bufB))) `plusPtr` off)
./base-4.7.0.0/GHC/Conc/Windows.hs:103: asyncWrite fd isSock len ((Ptr (byteArrayContents# (unsafeCoerce# bufB))) `plusPtr` off)
./base-4.7.0.0/GHC/ForeignPtr.hs:163: (# s', ForeignPtr (byteArrayContents# (unsafeCoerce# m
import Control.Monad
import Control.Concurrent
import Data.Int
import System.Environment
sendSidewards :: Chan Int -> Chan Int -> IO ()
sendSidewards from to = do
n <- readChan from
writeChan to n
sendSidewards from to
15:26:05 [I] Bootstrapping "project" in "/tmp/event"
15:26:05 [I] /tmp/event $ /usr/local/git/bin/git clone -n http://github.com/tibbe/event.git /tmp/event/.gittmp
15:26:05 [D] Executing /usr/local/git/bin/git clone -n http://github.com/tibbe/event.git /tmp/event/.gittmp ('/tmp/event')
15:26:05 [W] [Status 128]
15:26:05 [C] Checkout of project failed!
Failure applying upstream changes: /tmp/event $ /usr/local/git/bin/git clone -n http://github.com/tibbe/event.git /tmp/event/.gittmp failed
type TimeoutCallback = IO ()
data EventManager = EventManager
{ emTimeouts :: IORef (PSQ TimeoutCallback)
, ...
}
type TimeoutQueue = Q.PSQ TimeoutCallback
type TimeoutEdit = TimeoutQueue -> TimeoutQueue
applyTimeoutEdits :: TimeoutQueue -> [TimeoutEdit] -> TimeoutQueue
applyTimeoutEdits = foldr ($!)
type TimeoutCallback = IO ()
data EventManager = EventManager
{ emTimeouts :: IORef (PSQ TimeoutCallback)
, ...
}
-- | Register a timeout in the given number of milliseconds.
registerTimeout :: EventManager -> Int -> TimeoutCallback -> IO TimeoutKey
registerTimeout mgr ms cb = do
key <- newUnique (emUniqueSource mgr)
now <- getCurrentTime
let expTime = fromIntegral ms / 1000.0 + now
_ <- atomicModifyIORef (emTimeouts mgr) $ \q ->
let q' = Q.insert key expTime cb q in (q', q')
wakeManager mgr
return $! TK key