git.iko.soy/typeable/pandoc
on master help sign in
Use typeMismatch.
da070beJohn MacFarlane
src/Text/Pandoc/App/Opt.hs+2−1
@@ -35,6 +35,7 @@ import Text.Pandoc.Shared (camelCaseToHyphenated)
35import qualified Data.Text as T
35import qualified Data.Text as T
36import Data.Aeson (defaultOptions, Options(..), FromJSON(..), ToJSON(..),
36import Data.Aeson (defaultOptions, Options(..), FromJSON(..), ToJSON(..),
37 Value(..))
37 Value(..))
38+import Data.Aeson.Types (typeMismatch)
38#ifdef DERIVE_JSON_VIA_TH
39#ifdef DERIVE_JSON_VIA_TH
39import Data.Aeson.TH (deriveJSON)
40import Data.Aeson.TH (deriveJSON)
40#else
41#else
@@ -53,7 +54,7 @@ instance FromJSON LineEnding where
53 "crlf" -> return CRLF
54 "crlf" -> return CRLF
54 "native" -> return Native
55 "native" -> return Native
55 _ -> fail "Expecting LF, CRLF, or Native"
56 _ -> fail "Expecting LF, CRLF, or Native"
56− parseJSON _ = fail "Expecting string"
57+ parseJSON v = typeMismatch "String" v
57
58
58-- | Data structure for command line options.
59-- | Data structure for command line options.
59data Opt = Opt
60data Opt = Opt