-parseMIMEType :: String -> MIMEType
-parseMIMEType str = case parseStr mimeTypeP str of
- (# Success t, r #) -> if B.null r
- then t
- else error ("unparsable MIME Type: " ++ str)
- (# _ , _ #) -> error ("unparsable MIME Type: " ++ str)
-
+parseMIMEType ∷ Ascii → MIMEType
+parseMIMEType str
+ = let p = do t ← mimeTypeP
+ endOfInput
+ return t
+ bs = A.toByteString str
+ in
+ case parseOnly p bs of
+ Right t → t
+ Left err → error ("unparsable MIME Type: " ⧺ C8.unpack bs ⧺ ": " ⧺ err)