View default.nix
This file contains 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
let | |
nixpkgs-src = builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs-channels/archive/f197f57bd336746b53e5f1668ac7df1b63da7c9f.tar.gz"; | |
sha256 = "0cj4h39fhrm0nzxgfcjxy457zhi2rajpgm6abas816srmr4bb6nn"; | |
}; | |
semantic-src = builtins.fetchTarball { | |
url = "https://github.com/github/semantic/archive/78dad094fa2380aef36cabd48d57f6122f1034ec.tar.gz"; | |
sha256 = "0bk7f96fm9928nc2yv85cwchk43xh4yikbiqg7ngba5q6gj7xy04"; | |
}; | |
pkgs = import nixpkgs-src { config.allowBroken = true; }; |
View 2SAT.hs
This file contains 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 LambdaCase #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import qualified Data.Graph as G | |
import qualified Data.Array as A | |
import qualified Prelude as P | |
import Prelude hiding (lookup, read, replicate) |
View default.nix
This file contains 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
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }: | |
let | |
inherit (nixpkgs) pkgs; | |
f = { mkDerivation, base, base-orphans, bifunctors, containers | |
, data-pprint, deepseq, deepseq-generics, directory, either | |
, hashable, haskell-src-exts, hood, lens, mmorph, mtl, multistate | |
, parsec, pqueue, pretty, process, safe, split, stdenv |
View Owl.hs
This file contains 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
module Owl where | |
import System.FilePath ((</>)) | |
fromMaybe :: a -> Maybe a -> a | |
fromMaybe a m = case m of | |
Nothing -> a | |
Just b -> b | |
prependPath :: FilePath -> FilePath -> FilePath |
View count8s.hs
This file contains 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
import Data.List | |
count8s number = let | |
len = length $ filter (\string -> (read string :: Int) `mod` 8 == 0) $ tail $ subsequences number | |
in len `mod` (10^9+7) |
View KVStore.hs
This file contains 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
#!/usr/bin/env stack | |
{- stack --resolver lts-7 --install-ghc runghc | |
--package aeson | |
--package servant-server | |
--package text | |
--package transformers | |
--package unordered-containers | |
--package warp | |
-} |
View Leftovers.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View code-dojo-2016-11-29.hs
This file contains 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
import Data.List (inits, tails) | |
partitionSum [] n = n | |
partitionSum ls n = let | |
pairs = zip (tail $ inits ls) (tail $ tails ls) | |
pass = filter (\(l,r) -> (sum l) == (sum r)) pairs | |
maxes = map (\(l,r) -> max (partitionSum l (n+1)) (partitionSum r (n+1))) pass | |
in if (maxes == []) then n else (maximum maxes) | |
View empty-producer.hs
This file contains 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
#!/usr/bin/env stack | |
{- stack | |
--resolver lts-6.24 | |
runghc | |
--package attoparsec | |
--package pipes-bytestring | |
--package containers | |
--package pipes-zlib -} | |
{-# LANGUAGE OverloadedStrings #-} |
View decompress-fail.hs
This file contains 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
#!/usr/bin/env stack | |
{- stack | |
--resolver lts-6.24 | |
runghc | |
--package attoparsec | |
--package pipes-bytestring | |
--package containers | |
--package pipes-zlib -} | |
{-# LANGUAGE OverloadedStrings #-} |
NewerOlder