X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=ImplantFile.hs;fp=ImplantFile.hs;h=3b80e60844d3835cda549d64b5bd99325d7b282f;hp=0e91f1c6bdbb7bd2b5667d68790325ad5ad88a95;hb=6126eb9cbe5b38c300d855d96d2238831e59b5dd;hpb=558205096e7f51da7018458d173584ac31808082 diff --git a/ImplantFile.hs b/ImplantFile.hs index 0e91f1c..3b80e60 100644 --- a/ImplantFile.hs +++ b/ImplantFile.hs @@ -159,12 +159,10 @@ mkImports useGZip 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 @@ -234,22 +232,22 @@ resGetRaw 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 @@ -342,9 +340,9 @@ eTagToString = A.toString ∘ A.fromAsciiBuilder ∘ printETag 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 @@ -354,9 +352,9 @@ getModuleName opts 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 @@ -378,7 +376,7 @@ getMIMEType ∷ [CmdOpt] → FilePath → IO MIMEType 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." @@ -406,9 +404,9 @@ getLastModified fpath = (posixSecondsToUTCTime ∘ fromRational ∘ toRational 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 @@ -432,9 +430,9 @@ openInput fpath = Lazy.readFile fpath 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