packages feed

haskus-utils-variant 3.2.1 → 3.3

raw patch · 3 files changed

+48/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Haskus.Utils.Variant.Excepts: throwSomeE :: forall es' es a m. (Monad m, LiftVariant es' es) => V es' -> Excepts es m a
+ Haskus.Utils.Variant.VEither: instance GHC.Classes.Eq (Haskus.Utils.Variant.V (a : es)) => GHC.Classes.Eq (Haskus.Utils.Variant.VEither.VEither es a)
+ Haskus.Utils.Variant.VEither: instance GHC.Classes.Ord (Haskus.Utils.Variant.V (a : es)) => GHC.Classes.Ord (Haskus.Utils.Variant.VEither.VEither es a)

Files

haskus-utils-variant.cabal view
@@ -1,5 +1,5 @@ name:                haskus-utils-variant-version:             3.2.1+version:             3.3 synopsis:            Variant and EADT license:             BSD3 license-file:        LICENSE
src/lib/Haskus/Utils/Variant/Excepts.hs view
@@ -25,6 +25,7 @@    , failureE    , successE    , throwE+   , throwSomeE    , catchE    , catchEvalE    , evalE@@ -230,6 +231,11 @@ {-# INLINABLE throwE #-} throwE = Excepts . pure . VLeft . V +-- | Throw some exception+throwSomeE :: forall es' es a m. (Monad m, LiftVariant es' es) => V es' -> Excepts es m a+{-# INLINABLE throwSomeE #-}+throwSomeE = Excepts . pure . VLeft . liftVariant+ -- | Signal an exception value @e@. failureE :: forall e a m. Monad m => e -> Excepts '[e] m a {-# INLINABLE failureE #-}@@ -401,6 +407,8 @@    pure (veitherProduct v1 v2)  -- | Product of the sequential execution of two Excepts+--+-- The second one is run even if the first one failed! sequenceE ::    ( KnownNat (Length (b:e2))    , Monad m
src/lib/Haskus/Utils/Variant/VEither.hs view
@@ -16,6 +16,9 @@ {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}  -- | Variant biased towards one type --@@ -81,6 +84,42 @@       VRight x = VEither (toVariantHead x)  {-# COMPLETE VLeft,VRight #-}++----------------------+-- Eq instance+----------------------++-- | Check VEithers for equality+--+-- >>> let a = VRight "Foo" :: VEither '[Int,Double] String+-- >>> let b = VRight "Foo" :: VEither '[Int,Double] String+-- >>> let c = VRight "Bar" :: VEither '[Int,Double] String+-- >>> let d = VLeft (V (1::Int) :: V '[Int, Double]) :: VEither '[Int,Double] String+-- >>> a == b+-- True+-- >>> a == c+-- False+-- >>> a == d+-- False+--+deriving newtype instance (Eq (V (a ': es))) => Eq (VEither es a)+++----------------------+-- Ord instance+----------------------++-- | Compare VEithers+--+-- >>> let a = VRight "Foo" :: VEither '[Int,Double] String+-- >>> let b = VRight "Bar" :: VEither '[Int,Double] String+-- >>> a < b+-- False+-- >>> a > b+-- True+--+deriving newtype instance (Ord (V (a ': es))) => Ord (VEither es a)+  ---------------------- -- Show instance