packages feed

seqaid-0.1.3: Seqaid/Demo.hs

  {-# LANGUAGE CPP #-}

-- |
-- Module      :  Seqaid.Demo
-- Copyright   :  (c) 2014, Andrew G. Seniuk
-- License     :  BSD-style (see the file LICENSE)
--
-- Maintainer  :  Andrew Seniuk <rasfar@gmail.com>
-- Stability   :  provisional
-- Portability :  POSIX, Cabal
--
-- Instrument a sample program (package
-- <http://hackage.haskell.org/package/leaky leaky>)
-- with dynamic forcing functions.  Refer to
-- <http://hackage.haskell.org/package/deepseq-bounded deepseq-bounded>
-- for more information about this methodology.

  module Main ( main ) where
--module Seqaid.Demo ( main ) where

  import System.IO.Temp
  import System.Directory
  import System.Process

  leaky_version = "0.1.0.3"
--leaky_version = "0.1.0.0"

  main = do
            tdir <- createTempDirectory "." "leaky_"
-- XXX Note that "cabal get" already extracts the tarball for you.
#if IS_WINDOWS
            let bang_lines = ""
#else
            let bang_lines = "#!/bin/bash\nset -e\n"
#endif
            let seqaid_init_bash = bang_lines ++ "\
\cabal get leaky-" ++ leaky_version ++ "\n\
\cd leaky-" ++ leaky_version ++ "\n\
\cabal configure\n\
\cabal build\n\
\cabal run 123\n\
\echo\n\
\echo \"(Please see " ++ tdir ++ "/leaky-" ++ leaky_version ++ "/README for the interpretation.)\"\n\
\echo\n"
            setCurrentDirectory tdir
            writeFile "seqaidinit.sh" seqaid_init_bash
            p <- getPermissions "seqaidinit.sh"
            setPermissions "seqaidinit.sh" (p { executable = True })
            system "./seqaidinit.sh"