Skip to content

Instantly share code, notes, and snippets.

@larskuhtz
larskuhtz / Clock.hs
Last active October 19, 2017 22:23
A shared clock for DejaFu
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UnicodeSyntax #-}
-- |
@larskuhtz
larskuhtz / RandomByteString.hs
Created April 26, 2017 16:15
Efficiently Generate Random Haskell ByteString
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE BangPatterns #-}
module RandomByteString
( random
, randomGen
) where
import Control.Exception (bracketOnError)
@larskuhtz
larskuhtz / GadtsAndClosedTypeFamilies.hs
Last active April 1, 2016 01:34
GADTs and Close Type Families
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
module GadtClosedFamilyTest where
-- -------------------------------------------------------------------------- --
-- type level peano numbers
data Nat = Z | S Nat
@larskuhtz
larskuhtz / AsyncExc.hs
Last active August 29, 2015 14:20
Throwing asynchronous exceptions on threads with finalizers
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UnicodeSyntax #-}
-- | The tools for forking and managing threads from 'Control.Concurrent' and
-- 'Control.Concurrent.Async' don't guarantee that finalizers or exception
-- handlers on the thread are executed when an exception is raised on the
@larskuhtz
larskuhtz / README.md
Last active August 29, 2015 14:13
performance: http-client versus http-streams

Performance of http-streams and http-client

We compare the performance of the http-streams and the http-client libraries. The focus is on making a large number of small concurrent requests. This typically occurs in services that use HTTP to connect to backend services, such as a database, message queue, or log-message sink. Often those backend services use relatively small JSON encoded messages.