Skip to content

Instantly share code, notes, and snippets.

View ozgurakgun's full-sized avatar

Özgür Akgün ozgurakgun

View GitHub Profile
#!/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
@ozgurakgun
ozgurakgun / reproduce.cabal
Last active July 10, 2016 18:19
reproducing QuickCheck #101
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
@ozgurakgun
ozgurakgun / reproduce.cabal
Last active July 10, 2016 18:19
reproducing generic-deriving #41
Name: reproduce
Build-type: Simple
Cabal-version: >= 1.20
Library
default-language : Haskell2010
build-depends : base
, pretty > 1.1.1.1
, tasty-ant-xml
@ozgurakgun
ozgurakgun / shelly_test.hs
Last active March 25, 2016 11:06
print_stderr False, but stderr is still printed
{-# 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 )
#!/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
{-# 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
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