]> gitweb @ CieloNegro.org - Lucu.git/commitdiff
fix for interface change of Codec.Binary.Base64
authorpho <pho@cielonegro.org>
Wed, 23 Jan 2008 02:53:34 +0000 (11:53 +0900)
committerpho <pho@cielonegro.org>
Wed, 23 Jan 2008 02:53:34 +0000 (11:53 +0900)
darcs-hash:20080123025334-62b54-10c85d001971753f192f68d364efd416da6052fa.gz

ImplantFile.hs

index 7410b5f4cde3803c44a652a179763ee749298660..8ba976d681f95d6c31fe9dbe17aa4c86d23826fe 100644 (file)
@@ -120,6 +120,8 @@ generateHaskellSource opts srcFile
                                        False Nothing Nothing
                         , HsImportDecl undefined (Module "Data.ByteString.Lazy")
                                        True (Just (Module "L")) Nothing
+                        , HsImportDecl undefined (Module "Data.Maybe")
+                                       False Nothing Nothing
                         , HsImportDecl undefined (Module "Data.Time")
                                        False Nothing Nothing
                         , HsImportDecl undefined (Module "Network.HTTP.Lucu")
@@ -300,8 +302,10 @@ generateHaskellSource opts srcFile
              defGZippedData 
                  = HsApp (HsVar (Qual (Module "L") (HsIdent "pack")))
                    (HsParen
-                    (HsApp (HsVar (UnQual (HsIdent "decode")))
-                     (HsLit (HsString gzippedB64))))
+                    (HsApp (HsVar (UnQual (HsIdent "fromJust")))
+                     (HsParen
+                      (HsApp (HsVar (UnQual (HsIdent "decode")))
+                       (HsLit (HsString gzippedB64))))))
 
              declRawData :: [HsDecl]
              declRawData 
@@ -316,8 +320,10 @@ generateHaskellSource opts srcFile
              defRawData
                  = HsApp (HsVar (Qual (Module "L") (HsIdent "pack")))
                    (HsParen
-                    (HsApp (HsVar (UnQual (HsIdent "decode")))
-                     (HsLit (HsString rawB64))))
+                    (HsApp (HsVar (UnQual (HsIdent "fromJust")))
+                     (HsParen
+                      (HsApp (HsVar (UnQual (HsIdent "decode")))
+                       (HsLit (HsString rawB64))))))
 
          hPutStrLn output header
          hPutStrLn output (prettyPrint hsModule)
@@ -459,6 +465,7 @@ openOutput opts
   module Foo.Bar.Baz (baz) where
   import Codec.Binary.Base64
   import qualified Data.ByteString.Lazy as L
+  import Data.Maybe
   import Data.Time
   import Network.HTTP.Lucu
 
@@ -486,7 +493,7 @@ openOutput opts
   contentType = read "image/png"
 
   rawData :: L.ByteString
-  rawData = L.pack (decode "IyEvdXNyL2Jpbi9lbnYgcnVuZ2hjCgppbXBvcnQgRGlzdHJ...")
+  rawData = L.pack (fromJust (decode "IyEvdXNyL2Jpbi9lbnYgcnVuZ2hjCgppbXBvcnQgRGlzdHJ..."))
   ------------------------------------------------------------------------------
 
   壓縮される場合は次のやうに變はる:
@@ -518,6 +525,6 @@ openOutput opts
   
   -- rawData の代はりに gzippedData
   gzippedData :: L.ByteString
-  gzippedData = L.pack (decode "Otb/+DniOlRgAAAAYAAAAGAAAAB/6QOmToAEIGAAAAB...")
+  gzippedData = L.pack (fromJust (decode "Otb/+DniOlRgAAAAYAAAAGAAAAB/6QOmToAEIGAAAAB..."))
   ------------------------------------------------------------------------------
  -}