Skip to content

Commit

Permalink
fix #51, -d works again
Browse files Browse the repository at this point in the history
  • Loading branch information
melrief committed Aug 18, 2013
1 parent a3f241c commit 9a56bd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions hawk.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Library
build-depends: base
, bytestring
, containers
, stringsearch
Default-Language: Haskell98

Test-suite reference
Expand Down
6 changes: 4 additions & 2 deletions src/System/Console/Hawk.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Data.Function
import Data.Ord
import Data.Maybe
import Data.String
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB
import qualified Data.ByteString.Lazy.Search as S
import Language.Haskell.Interpreter
Expand Down Expand Up @@ -159,8 +160,9 @@ hawk config opts expr_str file = do
printRows b = printf "(System.Console.Hawk.Representable.printRows %s)"
(P.show b)

parseRows :: a -> String
parseRows d = "System.Console.Hawk.Representable.parseRows"
parseRows :: B.ByteString -> String
parseRows = printf "System.Console.Hawk.Representable.parseRows (%s)"
. P.show

getUsage :: IO String
getUsage = do
Expand Down
8 changes: 5 additions & 3 deletions src/System/Console/Hawk/Representable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ module System.Console.Hawk.Representable (

import Prelude
import Control.Exception (SomeException,handle)
import Data.ByteString.Lazy.Char8
import qualified Data.ByteString as StrictBS
import Data.ByteString.Lazy.Char8 (ByteString)
import qualified Data.ByteString.Lazy.Char8 as C8 hiding (hPutStrLn)
import qualified Data.List as L
import Data.Set (Set)
import qualified Data.Set as S
import qualified Data.ByteString.Lazy.Search as BS
import Data.Map (Map)
import qualified Data.Map as M
import GHC.IO.Exception (IOErrorType(ResourceVanished),IOException(ioe_type))
Expand All @@ -39,8 +41,8 @@ dropLastIfEmpty (x:xs) = x:dropLastIfEmpty xs
listMap :: (a -> b) -> [a] -> [b]
listMap = L.map

parseRows :: C8.ByteString -> [C8.ByteString]
parseRows = dropLastIfEmpty . C8.split '\n'
parseRows :: StrictBS.ByteString -> C8.ByteString -> [C8.ByteString]
parseRows delim str = dropLastIfEmpty $ BS.split delim str

runExpr :: (C8.ByteString -> IO ()) -> IO ()
runExpr f = do
Expand Down

0 comments on commit 9a56bd4

Please sign in to comment.