]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - examples/Multipart.hs
Update examples to work with current API
[Lucu.git] / examples / Multipart.hs
index ab857a8be0b13bf85f5beed89028011ca9a97cc0..f7122f9cc58aab710337c234c813b490bc0212ad 100644 (file)
@@ -7,6 +7,7 @@ import qualified Data.ByteString.Lazy.Char8 as Lazy
 import Control.Applicative
 import qualified Data.Collections as C
 import Control.Monad.Unicode
+import Data.Default
 import Data.Maybe
 import Data.Monoid.Unicode
 import Network
@@ -19,7 +20,7 @@ import Text.Blaze.Html5.Attributes hiding (form, title)
 import Text.Blaze.Renderer.Utf8
 
 main ∷ IO ()
-main = let config = defaultConfig { cnfServerPort = "9999" }
+main = let config = def { cnfServerPort = "9999" }
            tree   ∷ ResourceTree
            tree   = C.fromList [ ([], nonGreedy resMain) ]
        in
@@ -48,7 +49,7 @@ resMain = C.fromList
                  let text     = fromMaybe (∅) $ fdContent <$> lookup "text" f
                      file     = fromMaybe (∅) $ fdContent <$> lookup "file" f
                      fileName = fdFileName =≪ lookup "file" f
-                 setContentType $ parseMIMEType "text/plain"
+                 setContentType [mimeType| text/plain |]
                  putChunks $ "You entered \"" ⊕ text ⊕ "\".\n"
                  putChunks $ "You uploaded a " ⊕ Lazy.pack (show $ Lazy.length file) ⊕ " bytes long file.\n"
                  putChunks $ "The file name is " ⊕ Lazy.pack (show fileName) ⊕ ".\n"