Skip to content

Instantly share code, notes, and snippets.

@nh2
nh2 / ParallelConduit.hs
Last active August 31, 2018 20:33
DEPRECATED, use https://github.com/nh2/conduit-concurrent-map instead. Previous: Haskell: Shows how to make a conduit that maps a function in parallel over incoming elements, but maintains input order
#!/usr/bin/env stack
-- stack --resolver lts-8.12 script
-- Run this example with: `stack ParallelConduit.hs`
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

@folone
folone / gist:6089236
Last active October 10, 2020 18:26
Table of unicode operators in scalaz 6.0.x
@apeiros
apeiros / git_revision_entries.rb
Created February 7, 2013 20:34
Efficiently read arbitrary directories of an arbitrary git revision from a git repo into memory, without affecting the working directory.
# BEWARE! This code is largely untested and not ready for production!
Result = Struct.new(:entries, :raw_error, :status)
class Entry
HeaderUnpackFormat = "Z100A8A8A8A12A12A8aZ100A6A2Z32Z32A8A8Z155".freeze
EmptyString = "".freeze
OctalFields = [1,2,3,4,5,6,10,13,14]
def self.from_stream(io)
header = io.read(512)