packages feed

lifx-lan 0.8.0 → 0.8.1

raw patch · 3 files changed

+12/−10 lines, 3 filesdep ~ansi-terminaldep ~bytestringdep ~mtlPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: ansi-terminal, bytestring, mtl

API changes (from Hackage documentation)

- Lifx.Lan.Internal: instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Lifx.Lan.Internal.LifxT m)
+ Lifx.Lan.Internal: instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError (Data.Either.Either e Lifx.Lan.Internal.LifxError) (Lifx.Lan.Internal.LifxT m)

Files

lifx-lan.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               lifx-lan-version:            0.8.0+version:            0.8.1 license:            BSD-3-Clause license-file:       LICENSE author:             George Thomas@@ -27,20 +27,20 @@     ghc-options:         -Wall     build-depends:-        base ^>= {4.16},-        ansi-terminal ^>= 0.11.1,+        base ^>= {4.16, 4.17, 4.18},+        ansi-terminal ^>= {0.11.1, 1.0},         binary ^>= 0.8.8,-        bytestring ^>= {0.10.8, 0.11},+        bytestring ^>= {0.10.8, 0.11, 0.12},         colour ^>= 2.3.6,         composition ^>= 1.0.2.1,         containers ^>= 0.6.2.1,         extra ^>= 1.7.1,         monad-loops ^>= 0.4.3,-        mtl ^>= 2.2.2,+        mtl ^>= {2.2.2, 2.3},         network ^>= 3.1.1.1,         random ^>= 1.2.0,         safe ^>= 0.3.19,-        text ^>= 1.2.3,+        text ^>= {1.2.3, 2.0},         time ^>= {1.9.3, 1.10, 1.11, 1.12, 1.13},         transformers ^>= {0.5.6, 0.6},     default-language: Haskell2010
src/Lifx/Lan/Internal.hs view
@@ -101,10 +101,11 @@         ExceptT $ local f $ unLifx e s m instance MonadState s m => MonadState s (LifxT m) where     state = lift . state-instance MonadError e m => MonadError e (LifxT m) where-    throwError = lift . throwError @e @m-    catchError m h = LifxT $ StateT \s -> ReaderT \e ->-        ExceptT $ catchError @e @m (unLifx e s m) (unLifx e s . h)+instance MonadError e m => MonadError (Either e LifxError) (LifxT m) where+    throwError = either (lift . throwError @e @m) (LifxT . throwError)+    catchError m h = LifxT $ StateT \s -> ReaderT \e -> ExceptT do+        (m', s'') <- either ((,s) . h . Right) (first pure) <$> unLifx e s m+        catchError @e @m (unLifx e s'' m') (unLifx e s'' . h . Left)  unLifx :: (Socket, Word32, Int) -> Word8 -> LifxT m a -> m (Either LifxError (a, Word8)) unLifx e s = runExceptT . flip runReaderT e . flip runStateT s . (.unwrap)
src/Lifx/Lan/Mock/Terminal.hs view
@@ -4,6 +4,7 @@ -- | Rather than interacting with any bulbs, simulate interactions by printing to a terminal. module Lifx.Lan.Mock.Terminal (Mock, MockError, runMock, runMockFull, MockState (MockState)) where +import Control.Monad import Control.Monad.Except import Control.Monad.Reader import Control.Monad.State