Permalink
Browse files

ght show-idx: golf

  • Loading branch information...
kfish committed May 11, 2011
1 parent 35f7598 commit e027d1a96ebb5bef31e4883117ea713027f14f77
Showing with 4 additions and 5 deletions.
  1. +4 −5 tools/ght.hs
View
@@ -1,7 +1,9 @@
{-# OPTIONS -fwarn-unused-imports #-}
+
module Main where
import Control.Applicative ((<$>))
+import Control.Monad ((<=<))
import Control.Monad.Trans (liftIO)
import Data.Default
@@ -160,12 +162,9 @@ ghtShowIdx = defCmd {
cmdExamples = [("Show raw contents of pack pack-abcd.idx", "abcd")]
}
-ghtShowIdxHandler = do
- idx <- (liftIO . fIdx =<< appArgs)
- x <- liftIO $ dumpRawPackIndex idx
- liftIO $ putStrLn x
+ghtShowIdxHandler = mapM_ (liftIO . (putStrLn <=< dumpRawPackIndex <=< fIdx)) =<< appArgs
-fIdx (idx:_) = do
+fIdx idx = do
exists <- doesFileExist idx
if exists
then return idx

0 comments on commit e027d1a

Please sign in to comment.