mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 19:47:10 +03:00
Implement Eq instance for Unfold Identity
This commit is contained in:
parent
f08d73afa1
commit
43ba744ca5
@ -1,3 +1,4 @@
|
||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||
#include "inline.hs"
|
||||
|
||||
-- |
|
||||
@ -250,6 +251,8 @@ import Control.Exception (Exception, mask_)
|
||||
import Control.Monad.Catch (MonadCatch)
|
||||
import Control.Monad.IO.Class (MonadIO(..))
|
||||
import Control.Monad.Trans.Control (MonadBaseControl, liftBaseOp_)
|
||||
import Data.Functor.Identity (Identity, runIdentity)
|
||||
import Data.Void
|
||||
import GHC.Types (SPEC(..))
|
||||
import Streamly.Internal.Control.Concurrent (MonadAsync)
|
||||
import Streamly.Internal.Data.Fold.Type (Fold(..))
|
||||
@ -263,6 +266,7 @@ import qualified Control.Monad.Catch as MC
|
||||
import qualified Data.Tuple as Tuple
|
||||
import qualified Streamly.Internal.Data.Fold.Type as FL
|
||||
import qualified Streamly.Internal.Data.Stream.IsStream.Type as IsStream
|
||||
import qualified Streamly.Internal.Data.Stream.IsStream as IsStream2
|
||||
import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
|
||||
import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
|
||||
|
||||
@ -1137,3 +1141,11 @@ handle :: (MonadCatch m, Exception e)
|
||||
=> Unfold m e b -> Unfold m a b -> Unfold m a b
|
||||
handle exc =
|
||||
gbracket_ return MC.try (\_ -> return ()) (discardFirst exc)
|
||||
|
||||
instance Eq a => Eq (Unfold Identity Void a) where
|
||||
{-# INLINE (==) #-};
|
||||
(==) (uf1) (uf2) =
|
||||
runIdentity
|
||||
$ IsStream2.eqBy (==)
|
||||
(IsStream2.unfold uf1 undefined :: IsStream2.SerialT Identity a)
|
||||
(IsStream2.unfold uf2 undefined)
|
||||
|
Loading…
Reference in New Issue
Block a user