File: test.hs

package info (click to toggle)
haskell-hsh 2.0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 172 kB
  • ctags: 1
  • sloc: haskell: 945; makefile: 30
file content (19 lines) | stat: -rw-r--r-- 760 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import HSH
import Text.Printf
import System.Log.Logger
import System.Log.Handler.Syslog
import Data.Char

main = 
 do s <- openlog "test" [PID] USER DEBUG
    updateGlobalLogger rootLoggerName (addHandler s . setLevel DEBUG)
    --runIO $ "ls testsrc/testdata" -|- (map toUpper) -|- grep "BA"
    str <- run $ echo "bar\nbaz\nfoo\nquux\n" -|- "tr a-z A-Z"
    putStrLn str
    --runIO $ echo "bar\nbaz\nfoo\nquux\n" -|- "tr a-z A-Z" -|- "grep BA"
    --run $ ("ls", ["-l"]) -|-  countLines -|- ("grep", ["hs$"])
    --run $ (id::(String -> String)) -|- ("wc", ["-l"]) -|- countLines -|- ("grep", ["1"])
        --run $ ("ls", ["-l"]) -|- ("wc", ["-l"])

countLines :: [String] -> [String]
countLines = zipWith (\i line -> printf "%-5d %s" i line) [(1::Int)..]