]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - ImplantFile.hs
Merge branch 'convertible'
[Lucu.git] / ImplantFile.hs
index 60f9b54755911f631c693a053129867bb836f687..cbada793366c7b1d1265cdc0d2401f4602c1d300 100644 (file)
@@ -4,8 +4,11 @@
 module Main (main) where
 import Control.Applicative
 import Control.Monad
 module Main (main) where
 import Control.Applicative
 import Control.Monad
-import qualified Data.Ascii as A
+import Data.Ascii (Ascii)
+import Data.Attempt
 import Data.Char
 import Data.Char
+import Data.Convertible.Base
+import Data.Convertible.Utils
 import Data.Maybe
 import Language.Haskell.TH.PprLib
 import Language.Haskell.TH.Syntax
 import Data.Maybe
 import Language.Haskell.TH.PprLib
 import Language.Haskell.TH.Syntax
@@ -97,9 +100,9 @@ getMIMEType opts
     = case mimeTypeOpts of
         []  → Nothing
         OptMIMEType ty:[]
     = case mimeTypeOpts of
         []  → Nothing
         OptMIMEType ty:[]
-            → case A.fromChars ty of
-                 Just a  → Just $ parseMIMEType a
-                 Nothing → error "MIME types must not contain any non-ASCII letters."
+            → case convertAttemptVia ((⊥) ∷ Ascii) ty of
+                 Success a → Just a
+                 Failure e → error (show e)
         _   → error "too many --mime-type options."
     where
       mimeTypeOpts ∷ [CmdOpt]
         _   → error "too many --mime-type options."
     where
       mimeTypeOpts ∷ [CmdOpt]
@@ -122,9 +125,9 @@ getETag opts
 
       strToETag ∷ String → ETag
       strToETag str
 
       strToETag ∷ String → ETag
       strToETag str
-          = case A.fromChars str of
-              Just a  → strongETag a
-              Nothing → error "ETag must not contain any non-ASCII letters."
+          = case ca str of
+              Success a → strongETag a
+              Failure e → error (show e)
 
 openOutput ∷ [CmdOpt] → IO Handle
 openOutput opts
 
 openOutput ∷ [CmdOpt] → IO Handle
 openOutput opts