X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=ImplantFile.hs;fp=ImplantFile.hs;h=cbada793366c7b1d1265cdc0d2401f4602c1d300;hp=60f9b54755911f631c693a053129867bb836f687;hb=5f2ef377345fc47aabc63c1325df82c1cd9da9ed;hpb=313924e79d4ed48d3efb9f2530a48305fdd68c4b diff --git a/ImplantFile.hs b/ImplantFile.hs index 60f9b54..cbada79 100644 --- a/ImplantFile.hs +++ b/ImplantFile.hs @@ -4,8 +4,11 @@ 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.Convertible.Base +import Data.Convertible.Utils 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 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] @@ -122,9 +125,9 @@ getETag opts 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