on master help sign in
use QuantifiedConstraints on IsStream type class

This can help in signatures with lesser constraints where we use polymorphic code that requires the stream to be a functor/applicative/semigroup/monoid. fixes #155

commita1e093ae0dcb3483ff4520a42c4b67b6cfc6bc61 authorHarendra Kumar <harendra.kumar@gmail.com> dateTue 12 Nov 2019, 11:03 (7 years ago) parentecb846d
1 file changed+12−1
src/Streamly/Streams/StreamK/Type.hs+12−1
src/Streamly/Streams/StreamK/Type.hs+12−1
@@ -8,6 +8,9 @@
88{-# LANGUAGE PatternSynonyms #-}
99{-# LANGUAGE KindSignatures #-}
1010{-# LANGUAGE ViewPatterns #-}
11+#if __GLASGOW_HASKELL__ >= 806
12+{-# LANGUAGE QuantifiedConstraints #-}
13+#endif
1114{-# LANGUAGE RankNTypes #-}
1215{-# LANGUAGE UndecidableInstances #-} -- XXX
1316
@@ -142,7 +145,15 @@ infixr 5 |:
142145-- some monad 'm'.
143146--
144147-- @since 0.2.0
145−class IsStream t where
148+class
149+#if __GLASGOW_HASKELL__ >= 806
150+ ( forall m a. MonadAsync m => Semigroup (t m a)
151+ , forall m a. MonadAsync m => Monoid (t m a)
152+ , forall m. Monad m => Functor (t m)
153+ , forall m. MonadAsync m => Applicative (t m)
154+ ) =>
155+#endif
156+ IsStream t where
146157 toStream :: t m a -> Stream m a
147158 fromStream :: Stream m a -> t m a
148159 -- | Constructs a stream by adding a monadic action at the head of an