on master help sign in
Use throwM
commit6fc6b5c9c0c7abbbb5e072cd4a8d8c0dc04000b3 authorMichael Snoyman <michael@snoyman.com> dateSat 30 Dec 2017, 22:16 (9 years ago) parent22e0c0e
3 files changed+14−10
ChangeLog.md+4 Data/Yaml/Parser.hs+7−7 yaml.cabal+3−3
ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 0.8.25.2
2+
3+* Use `throwM` instead of `monadThrow`
4+
15## 0.8.25.1
26
37* Drop aeson-qq dep (incompatible with Stackage Nightly)
Data/Yaml/Parser.hs+7−7
@@ -9,7 +9,7 @@ import Control.Applicative
99import Control.Exception (Exception)
1010import Control.Monad (MonadPlus (..), liftM, ap)
1111import Control.Monad.Trans.Class (lift)
12−import Control.Monad.Trans.Resource (MonadThrow, monadThrow, runResourceT)
12+import Control.Monad.Trans.Resource (MonadThrow, throwM, runResourceT)
1313import Control.Monad.Trans.Writer.Strict (tell, WriterT)
1414import Data.ByteString (ByteString)
1515import Data.Conduit
@@ -124,7 +124,7 @@ data RawDoc = RawDoc YamlValue AnchorMap
124124parseRawDoc :: (FromYaml a, MonadThrow m) => RawDoc -> m a
125125parseRawDoc (RawDoc val am) =
126126 case unYamlParser (fromYaml val) am of
127− Left t -> monadThrow $ FromYamlException t
127+ Left t -> throwM $ FromYamlException t
128128 Right x -> return x
129129
130130(.:) :: FromYaml a => [(Text, YamlValue)] -> Text -> YamlParser a
@@ -144,7 +144,7 @@ sinkValue :: MonadThrow m => Consumer Event (WriterT AnchorMap m) YamlValue
144144sinkValue =
145145 start
146146 where
147− start = await >>= maybe (monadThrow UnexpectedEndOfEvents) go
147+ start = await >>= maybe (throwM UnexpectedEndOfEvents) go
148148
149149 tell' Nothing val = return val
150150 tell' (Just name) val = do
@@ -164,12 +164,12 @@ sinkValue =
164164 let val = Mapping pairs mname
165165 tell' mname val
166166
167− go e = monadThrow $ UnexpectedEvent e
167+ go e = throwM $ UnexpectedEvent e
168168
169169 goS front = do
170170 me <- await
171171 case me of
172− Nothing -> monadThrow UnexpectedEndOfEvents
172+ Nothing -> throwM UnexpectedEndOfEvents
173173 Just EventSequenceEnd -> return $ front []
174174 Just e -> do
175175 val <- go e
@@ -178,14 +178,14 @@ sinkValue =
178178 goM front = do
179179 mk <- await
180180 case mk of
181− Nothing -> monadThrow UnexpectedEndOfEvents
181+ Nothing -> throwM UnexpectedEndOfEvents
182182 Just EventMappingEnd -> return $ front []
183183 Just (EventScalar a b c d) -> do
184184 _ <- tell' d $ Scalar a b c d
185185 let k = decodeUtf8 a
186186 v <- start
187187 goM (front . ((k, v):))
188− Just e -> monadThrow $ UnexpectedEvent e
188+ Just e -> throwM $ UnexpectedEvent e
189189
190190sinkRawDoc :: MonadThrow m => Consumer Event m RawDoc
191191sinkRawDoc = uncurry RawDoc <$> runWriterC sinkValue
yaml.cabal+3−3
@@ -1,5 +1,5 @@
11name: yaml
2−version: 0.8.25.1
2+version: 0.8.25.2
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
@@ -48,8 +48,8 @@ library
4848 build-depends: base >= 4 && < 5
4949 , transformers >= 0.1
5050 , bytestring >= 0.9.1.4
51− , conduit >= 1.1.0 && < 1.3
52− , resourcet >= 0.3 && < 1.2
51+ , conduit >= 1.1.0 && < 1.4
52+ , resourcet >= 0.3 && < 1.3
5353 , aeson >= 0.7
5454 , containers
5555 , unordered-containers