view paste/paste.14186 @ 11211:dc839e3d282d

<b_jonas> `` gzip -dc share/mtg/All\\ Sets-2017-09-20.zip > share/mtg/allsets-2017-09-20.zip
author HackBot
date Wed, 04 Oct 2017 11:30:07 +0000
parents e037173e0012
children
line wrap: on
line source

import System.Environment
import System.Process
import System.Exit
import Control.Monad
import Control.Applicative
import Data.List

main = do
    r <- buildRegex . permuteArgs <$> getArgs
    (_, _, _, h) <- createProcess (proc "/hackenv/bin/log" [r])
    exitWith <$> waitForProcess h
   where
     permuteArgs = permutations . join . map words
     buildRegex = oBrackets . intercalate ".*" . map (iBrackets . intercalate "|")
     iBrackets s = "(?:" ++ s ++ ")"
     oBrackets s = "^.*(?:" ++ s ++ ").*$"