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
unionAll :: (Ord a) => [[a]] -> [a] | |
unionAll xs = | |
let | |
xs' = filter (not.null) xs -- | filter empty lists, if any | |
in | |
if null xs' -- | if nothing is left after filtering | |
then [] -- | return the empty list | |
else -- | otherwise | |
let | |
next = minimum (map head xs') -- | find the minimum of head elements |
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 GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
module GADTExpr where | |
import Data.Function(on) | |
import Data.Ord(comparing) | |
class (Eq a, Ord a, Show a) => ExprType a where | |
toExpr :: a -> Expr a |
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 OverloadedStrings #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Main where | |
import System.IO ( Handle ) | |
import System.Environment ( getArgs ) | |
import GHC.IO.Handle ( hIsEOF, hClose, hGetLine ) | |
import Control.Monad.IO.Class ( liftIO ) |
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
Name: reproduce | |
Build-type: Simple | |
Cabal-version: >= 1.20 | |
Library | |
default-language : Haskell2010 | |
build-depends : base | |
, pretty > 1.1.1.1 | |
, QuickCheck == 2.8.2 |
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
Name: reproduce | |
Build-type: Simple | |
Cabal-version: >= 1.20 | |
Library | |
default-language : Haskell2010 | |
build-depends : base | |
, pretty > 1.1.1.1 | |
, tasty-ant-xml |
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-8.19 script --system-ghc --package megaparsec | |
import Text.Megaparsec | |
import Text.Megaparsec.Char | |
import Text.Megaparsec.Error | |
import Text.Megaparsec.Expr | |
import Text.Megaparsec.Lexer | |
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
#!/bin/bash | |
num=4 # num is number of cores | |
qFile='path/to/your/queue.file' # this is the queue file | |
on_die() | |
{ | |
echo "Stopping..." | |
rm $qFile | |
exit 0 |