This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tryAll :: IO a -> IO (Either SomeException a) | |
tryAll = try | |
forkIO_ :: IO () -> IO () | |
forkIO_ x = forkIO x >> pure () | |
foldCommuteIO :: forall t m a. (Foldable t, Monoid m) => (a -> IO m) -> t a -> IO m | |
foldCommuteIO f xs = do | |
var <- newEmptyMVar | |
total <- foldlM (\ !n a -> forkIO_ ( tryAll (f a) >>= putMVar var) >> pure (n + 1)) 0 xs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[nix-shell:~/development/nixpkgs]$ nix repl default.nix | |
Welcome to Nix version 2.0.4. Type :? for help. | |
Loading 'default.nix'... | |
Added 9659 variables. | |
nix-repl> :b haskell.compiler.ghcLinear | |
these derivations will be built: | |
/nix/store/pifcl83nn43wkvsdwg1k4m089g44jqvl-hscolour-1.24.4.drv | |
/nix/store/77psczhb9v2j3k2av0pj52vc886v86xm-hscolour-1.24.4.drv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Ordered a = Empty | Decreasing a | Increasing a | |
inc :: Ordered a -> Bool | |
inc (Decreasing _) = False | |
inc _ = True | |
dec :: Ordered a -> Bool | |
dec (Increasing _) = False | |
dec _ = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
dir=$(mktemp -d dist-new-docs.XXXXXX) | |
trap 'rm -r "$dir"' EXIT | |
cabal new-haddock --builddir="$dir" --haddock-for-hackage --haddock-option=--hyperlinked-source | |
# Starting with cabal 2.0, `--publish` is needed for uploading to non-candidate releases | |
cabal upload --publish -d $dir/*-docs.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE BangPatterns #-} | |
{-# LANGUAGE MagicHash #-} | |
module Strict (idInt, idIntCon) where | |
import GHC.Types | |
idIntCon :: Int -> Int | |
idIntCon (I# x) = (I# x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hPutMutableByteArray# | |
:: SIO.Handle | |
-> MutableByteArray# RealWorld -- ^ Invariant MUST BE PINNED | |
-> Int# | |
-> State# RealWorld |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MagicHash #-} | |
{-# LANGUAGE UnboxedTuples #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeInType #-} | |
-- | Conversion between unlifted and lifted datatypes | |
module Packed.Levity | |
( -- * Types | |
Rep | |
, Levity(..) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ rev # The Git revision of nixpkgs to fetch | |
, sha256 # The SHA256 hash of the unpacked archive | |
}: | |
builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; | |
inherit sha256; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
#include <fstream> | |
#include <string> | |
#include <stdio.h> | |
#include <cstring> | |
int main () | |
{ | |
std::ifstream in("infile.txt"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Copyright (c) 2014, Ryan Trinkle | |
-- All rights reserved. | |
-- | |
-- Redistribution and use in source and binary forms, with or without | |
-- modification, are permitted provided that the following conditions are met: | |
-- | |
-- * Redistributions of source code must retain the above copyright notice, this | |
-- list of conditions and the following disclaimer. | |
-- | |
-- * Redistributions in binary form must reproduce the above copyright notice, |