Commit 4cb79af4 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Merge pull request #2215 from lspitzner/nomomore

Prettify code to ensure compilation with -XNoMonomorphismRestriction
parents 468d95a7 61ebaef7
...@@ -124,6 +124,7 @@ wipeMetadata path = do ...@@ -124,6 +124,7 @@ wipeMetadata path = do
, "0 " -- GID, 6 bytes , "0 " -- GID, 6 bytes
, "0644 " -- mode, 8 bytes , "0644 " -- mode, 8 bytes
] ]
headerSize :: Int
headerSize = 60 headerSize = 60
-- http://en.wikipedia.org/wiki/Ar_(Unix)#File_format_details -- http://en.wikipedia.org/wiki/Ar_(Unix)#File_format_details
......
...@@ -269,11 +269,7 @@ list verbosity hcPkg packagedb = do ...@@ -269,11 +269,7 @@ list verbosity hcPkg packagedb = do
++ programId hcPkg ++ " list'" ++ programId hcPkg ++ " list'"
where where
parsePackageIds str = parsePackageIds = sequence . map simpleParse . words
let parsed = map simpleParse (words str)
in case [ () | Nothing <- parsed ] of
[] -> Just [ pkgid | Just pkgid <- parsed ]
_ -> Nothing
-------------------------- --------------------------
......
...@@ -49,8 +49,6 @@ import Data.Char as Char ...@@ -49,8 +49,6 @@ import Data.Char as Char
import Data.List import Data.List
( unionBy, deleteFirstsBy, nubBy ) ( unionBy, deleteFirstsBy, nubBy )
import Data.Maybe
( isJust, fromJust )
import System.IO.Error import System.IO.Error
( isDoesNotExistError ) ( isDoesNotExistError )
import qualified Data.ByteString.Lazy.Char8 as B import qualified Data.ByteString.Lazy.Char8 as B
...@@ -113,9 +111,9 @@ getContents :: FilePath -> IO [WorldPkgInfo] ...@@ -113,9 +111,9 @@ getContents :: FilePath -> IO [WorldPkgInfo]
getContents world = do getContents world = do
content <- safelyReadFile world content <- safelyReadFile world
let result = map simpleParse (lines $ B.unpack content) let result = map simpleParse (lines $ B.unpack content)
if all isJust result case sequence result of
then return $ map fromJust result Nothing -> die "Could not parse world file."
else die "Could not parse world file." Just xs -> return xs
where where
safelyReadFile :: FilePath -> IO B.ByteString safelyReadFile :: FilePath -> IO B.ByteString
safelyReadFile file = B.readFile file `catchIO` handler safelyReadFile file = B.readFile file `catchIO` handler
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment