[use bytestrings to write CFF files. clean up some code, improve other error messages
John Meacham <john@repetae.net>**20080211100521] hunk ./Ho/Build.hs 60
+import qualified Data.ByteString.Lazy as LBS
hunk ./Ho/Build.hs 158
-            (_,_,_,ho_name) <- moduleFind r_dm (Left m)
-            loadHoFile r_dm ho_name
+            (_,hash,_,ho_name) <- moduleFind r_dm (Left m)
+            if hash == MD5.emptyHash
+                then fail $ "could not find ho file: " ++ show m
+                else loadHoFile r_dm ho_name
hunk ./Ho/Build.hs 171
-                unless (h == h') $ do
-                    fn <- shortenPath fn
-                    putVerboseLn $ ho_name' <+> "is out of date due to changed file:" <+> fn
-                    True <- return False
-                    return ()
+                unless (h == h') $
+                    if h' == MD5.emptyHash then do
+                        putVerboseLn $ ho_name' <+> "not found at" <+> show m
+                        fail "odd module thing"
+                    else do
+                        fn <- shortenPath fn
+                        putVerboseLn $ ho_name' <+> "is out of date due to changed file:" <+> fn
+                        fail "Module out of date"
hunk ./Ho/Build.hs 245
-findModule :: [Either Module String]                             -- ^ Either a module or filename to find
+findModule :: [Either Module String]                                -- ^ Either a module or filename to find
hunk ./Ho/Build.hs 248
-              -> IO (CollectedHo,[(Module,MD5.Hash)],Ho)                                -- ^ (Final accumulated ho,just the ho read to satisfy this command)
+              -> IO (CollectedHo,[(Module,MD5.Hash)],Ho)            -- ^ (Final accumulated ho,just the ho read to satisfy this command)
hunk ./Ho/Build.hs 297
-                                 hohHash = undefined,
+                                 hohHash = error "fillInHohHash - hoHash",
hunk ./Ho/Build.hs 363
-            fh <- openBinaryFile tfn WriteMode
hunk ./Ho/Build.hs 364
-            lazyWriteCFF fh cff_magic [
-                (cff_jhdr, compress $ encode header),
-                (cff_defs, compress $ encode $ hoExp theho),
-                (cff_core, compress $ encode $ hoBuild theho)]
-            hFlush fh
-            hClose fh
+                cfflbs = mkCFFfile cff_magic [
+                    (cff_jhdr, compress $ encode header),
+                    (cff_defs, compress $ encode $ hoExp theho),
+                    (cff_core, compress $ encode $ hoBuild theho)]
+            LBS.writeFile tfn cfflbs