on master help sign in
Use throwM
6fc6b5cMichael Snoyman
ChangeLog.md+4
@@ -1,3 +1,7 @@
1+## 0.8.25.2
2+
3+* Use `throwM` instead of `monadThrow`
4+
1## 0.8.25.1
5## 0.8.25.1
2
6
3* Drop aeson-qq dep (incompatible with Stackage Nightly)
7* Drop aeson-qq dep (incompatible with Stackage Nightly)
Data/Yaml/Parser.hs+7−7
@@ -9,7 +9,7 @@ import Control.Applicative
9import Control.Exception (Exception)
9import Control.Exception (Exception)
10import Control.Monad (MonadPlus (..), liftM, ap)
10import Control.Monad (MonadPlus (..), liftM, ap)
11import Control.Monad.Trans.Class (lift)
11import Control.Monad.Trans.Class (lift)
12−import Control.Monad.Trans.Resource (MonadThrow, monadThrow, runResourceT)
12+import Control.Monad.Trans.Resource (MonadThrow, throwM, runResourceT)
13import Control.Monad.Trans.Writer.Strict (tell, WriterT)
13import Control.Monad.Trans.Writer.Strict (tell, WriterT)
14import Data.ByteString (ByteString)
14import Data.ByteString (ByteString)
15import Data.Conduit
15import Data.Conduit
@@ -124,7 +124,7 @@ data RawDoc = RawDoc YamlValue AnchorMap
124parseRawDoc :: (FromYaml a, MonadThrow m) => RawDoc -> m a
124parseRawDoc :: (FromYaml a, MonadThrow m) => RawDoc -> m a
125parseRawDoc (RawDoc val am) =
125parseRawDoc (RawDoc val am) =
126 case unYamlParser (fromYaml val) am of
126 case unYamlParser (fromYaml val) am of
127− Left t -> monadThrow $ FromYamlException t
127+ Left t -> throwM $ FromYamlException t
128 Right x -> return x
128 Right x -> return x
129
129
130(.:) :: FromYaml a => [(Text, YamlValue)] -> Text -> YamlParser a
130(.:) :: FromYaml a => [(Text, YamlValue)] -> Text -> YamlParser a
@@ -144,7 +144,7 @@ sinkValue :: MonadThrow m => Consumer Event (WriterT AnchorMap m) YamlValue
144sinkValue =
144sinkValue =
145 start
145 start
146 where
146 where
147− start = await >>= maybe (monadThrow UnexpectedEndOfEvents) go
147+ start = await >>= maybe (throwM UnexpectedEndOfEvents) go
148
148
149 tell' Nothing val = return val
149 tell' Nothing val = return val
150 tell' (Just name) val = do
150 tell' (Just name) val = do
@@ -164,12 +164,12 @@ sinkValue =
164 let val = Mapping pairs mname
164 let val = Mapping pairs mname
165 tell' mname val
165 tell' mname val
166
166
167− go e = monadThrow $ UnexpectedEvent e
167+ go e = throwM $ UnexpectedEvent e
168
168
169 goS front = do
169 goS front = do
170 me <- await
170 me <- await
171 case me of
171 case me of
172− Nothing -> monadThrow UnexpectedEndOfEvents
172+ Nothing -> throwM UnexpectedEndOfEvents
173 Just EventSequenceEnd -> return $ front []
173 Just EventSequenceEnd -> return $ front []
174 Just e -> do
174 Just e -> do
175 val <- go e
175 val <- go e
@@ -178,14 +178,14 @@ sinkValue =
178 goM front = do
178 goM front = do
179 mk <- await
179 mk <- await
180 case mk of
180 case mk of
181− Nothing -> monadThrow UnexpectedEndOfEvents
181+ Nothing -> throwM UnexpectedEndOfEvents
182 Just EventMappingEnd -> return $ front []
182 Just EventMappingEnd -> return $ front []
183 Just (EventScalar a b c d) -> do
183 Just (EventScalar a b c d) -> do
184 _ <- tell' d $ Scalar a b c d
184 _ <- tell' d $ Scalar a b c d
185 let k = decodeUtf8 a
185 let k = decodeUtf8 a
186 v <- start
186 v <- start
187 goM (front . ((k, v):))
187 goM (front . ((k, v):))
188− Just e -> monadThrow $ UnexpectedEvent e
188+ Just e -> throwM $ UnexpectedEvent e
189
189
190sinkRawDoc :: MonadThrow m => Consumer Event m RawDoc
190sinkRawDoc :: MonadThrow m => Consumer Event m RawDoc
191sinkRawDoc = uncurry RawDoc <$> runWriterC sinkValue
191sinkRawDoc = uncurry RawDoc <$> runWriterC sinkValue
yaml.cabal+3−3
@@ -1,5 +1,5 @@
1name: yaml
1name: yaml
2−version: 0.8.25.1
2+version: 0.8.25.2
3license: BSD3
3license: BSD3
4license-file: LICENSE
4license-file: LICENSE
5author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
5author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov
@@ -48,8 +48,8 @@ library
48 build-depends: base >= 4 && < 5
48 build-depends: base >= 4 && < 5
49 , transformers >= 0.1
49 , transformers >= 0.1
50 , bytestring >= 0.9.1.4
50 , bytestring >= 0.9.1.4
51− , conduit >= 1.1.0 && < 1.3
51+ , conduit >= 1.1.0 && < 1.4
52− , resourcet >= 0.3 && < 1.2
52+ , resourcet >= 0.3 && < 1.3
53 , aeson >= 0.7
53 , aeson >= 0.7
54 , containers
54 , containers
55 , unordered-containers
55 , unordered-containers