File: main.hs

package info (click to toggle)
haskell-pager 0.1.1.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68 kB
  • sloc: haskell: 126; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 764 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import qualified Data.ByteString.Lazy as B
import qualified Data.Text.IO as TIO
import Data.Conduit.Binary
import Paths_pager
import System.Pager

testPrintOrPage :: FilePath ->  IO ()
testPrintOrPage fnom =
  TIO.readFile fnom >>= printOrPage

testConduit :: FilePath ->  IO ()
testConduit fnom =
  sendToPagerConduit (sourceFile fnom)

test :: FilePath -> IO ()
test fp = B.readFile fp >>= sendToPager

main :: IO ()
main =
  do fnom <- getDataFileName "LICENSE"
     putStrLn "Hit Return to start the conduit-free test"
     _ <- getLine
     test fnom
     putStrLn "Hit Return to start the conduit test"
     _ <- getLine
     testConduit fnom
     putStrLn "Hit Return to start the printOrPage test (no conduits)"
     _ <- getLine
     testPrintOrPage fnom