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")
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
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)
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
contentType = read "image/png"
rawData :: L.ByteString
- rawData = L.pack (decode "IyEvdXNyL2Jpbi9lbnYgcnVuZ2hjCgppbXBvcnQgRGlzdHJ...")
+ rawData = L.pack (fromJust (decode "IyEvdXNyL2Jpbi9lbnYgcnVuZ2hjCgppbXBvcnQgRGlzdHJ..."))
------------------------------------------------------------------------------
壓縮される場合は次のやうに變はる:
-- rawData の代はりに gzippedData
gzippedData :: L.ByteString
- gzippedData = L.pack (decode "Otb/+DniOlRgAAAAYAAAAGAAAAB/6QOmToAEIGAAAAB...")
+ gzippedData = L.pack (fromJust (decode "Otb/+DniOlRgAAAAYAAAAGAAAAB/6QOmToAEIGAAAAB..."))
------------------------------------------------------------------------------
-}