False False Nothing Nothing Nothing
]
⧺
- if useGZip then
- [ ImportDecl (⊥) (ModuleName "Codec.Compression.GZip")
- False False Nothing Nothing Nothing
- ]
- else
- []
+ [ ImportDecl (⊥) (ModuleName "Codec.Compression.GZip")
+ False False Nothing Nothing Nothing
+ | useGZip
+ ]
resourceDecl ∷ Name → Bool → [Decl]
resourceDecl symName useGZip
setContentEncodingGZipStmt ∷ Stmt
setContentEncodingGZipStmt
= qualStmt $
- metaFunction "setContentEncoding" $
- [ listE [ strE "gzip" ] ]
+ metaFunction "setContentEncoding"
+ [ listE [ strE "gzip" ] ]
foundEntityStmt ∷ Stmt
foundEntityStmt
= qualStmt $
- metaFunction "foundEntity" $
- [ var $ name "entityTag"
- , var $ name "lastModified"
- ]
+ metaFunction "foundEntity"
+ [ var $ name "entityTag"
+ , var $ name "lastModified"
+ ]
setContentTypeStmt ∷ Stmt
setContentTypeStmt
= qualStmt $
- metaFunction "setContentType" $
- [var $ name "contentType"]
+ metaFunction "setContentType"
+ [var $ name "contentType"]
outputStmt ∷ Exp → Stmt
outputStmt e
getModuleName ∷ [CmdOpt] → IO ModuleName
getModuleName opts
= case modNameOpts of
- [] → fail "a module name must be given."
- (OptModName modName):[] → return $ ModuleName modName
- _ → fail "too many --module options."
+ [] → fail "a module name must be given."
+ OptModName modName:[] → return $ ModuleName modName
+ _ → fail "too many --module options."
where
modNameOpts ∷ [CmdOpt]
modNameOpts = filter (\ x → case x of
getSymbolName ∷ [CmdOpt] → ModuleName → IO Name
getSymbolName opts (ModuleName modName)
= case symNameOpts of
- [] → return defaultSymName
- (OptSymName symName):[] → return $ name symName
- _ → fail "too many --symbol options."
+ [] → return defaultSymName
+ OptSymName symName:[] → return $ name symName
+ _ → fail "too many --symbol options."
where
symNameOpts ∷ [CmdOpt]
symNameOpts = filter (\ x → case x of
getMIMEType opts srcFile
= case mimeTypeOpts of
[] → return defaultType
- (OptMIMEType ty):[]
+ OptMIMEType ty:[]
→ case A.fromChars ty of
Just a → return $ parseMIMEType a
Nothing → fail "MIME type must not contain any non-ASCII letters."
getETag ∷ [CmdOpt] → Lazy.ByteString → IO ETag
getETag opts input
= case eTagOpts of
- [] → return $ mkETagFromInput
- (OptETag str):[] → return $ strToETag str
- _ → fail "too many --etag options."
+ [] → return mkETagFromInput
+ OptETag str:[] → return $ strToETag str
+ _ → fail "too many --etag options."
where
eTagOpts ∷ [CmdOpt]
eTagOpts = filter (\ x → case x of
openOutput ∷ [CmdOpt] → IO Handle
openOutput opts
= case outputOpts of
- [] → return stdout
- (OptOutput fpath):[] → openFile fpath WriteMode
- _ → fail "two many --output options."
+ [] → return stdout
+ OptOutput fpath:[] → openFile fpath WriteMode
+ _ → fail "two many --output options."
where
outputOpts ∷ [CmdOpt]
outputOpts = filter (\ x → case x of