on master help sign in
Disallow some language extensions from default use

* UndecidableInstances -- Don't want to use unless indicated * TypeFamilies -- Causes large regressions and improvements * UnboxedTuples -- interferes with (#.)

commit1367bd647d534cfa4e8f45a87d905e97653a6052 authorHarendra Kumar <harendra@composewell.com> dateSun 28 Jun 2020, 21:10 (6 years ago) parent6190f1b
17 files changed+41−7
src/Streamly/Internal/Data/Array.hs+1 src/Streamly/Internal/Data/List.hs+3 src/Streamly/Internal/Data/SVar.hs+2 src/Streamly/Internal/Data/SmallArray.hs+1 src/Streamly/Internal/Data/Stream/Ahead.hs+2 src/Streamly/Internal/Data/Stream/Async.hs+4 src/Streamly/Internal/Data/Stream/Parallel.hs+2 src/Streamly/Internal/Data/Stream/SVar.hs+2−4 src/Streamly/Internal/Data/Stream/Serial.hs+3 src/Streamly/Internal/Data/Stream/StreamK.hs+2 src/Streamly/Internal/Data/Stream/StreamK/Type.hs+2 src/Streamly/Internal/Data/Stream/Zip.hs+3 src/Streamly/Internal/Memory/Array.hs+2 src/Streamly/Internal/Memory/Array/Types.hs+3 src/Streamly/Internal/Mutable/Prim/Var.hs+2 src/Streamly/Memory/Malloc.hs+2 streamly.cabal+5−3
src/Streamly/Internal/Data/Array.hs+1
@@ -1,5 +1,6 @@
11{-# OPTIONS_GHC -fno-warn-orphans #-}
22
3+{-# LANGUAGE UnboxedTuples #-}
34#include "inline.hs"
45
56-- |
src/Streamly/Internal/Data/List.hs+3
@@ -1,3 +1,6 @@
1+{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE UndecidableInstances #-}
3+
14-- |
25-- Module : Streamly.Internal.Data.List
36-- Copyright : (c) 2018 Composewell Technologies
src/Streamly/Internal/Data/SVar.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UnboxedTuples #-}
2+
13-- |
24-- Module : Streamly.Internal.Data.SVar
35-- Copyright : (c) 2017 Harendra Kumar
src/Streamly/Internal/Data/SmallArray.hs+1
@@ -8,6 +8,7 @@
88-- Portability : GHC
99
1010{-# OPTIONS_GHC -fno-warn-orphans #-}
11+{-# LANGUAGE UnboxedTuples #-}
1112
1213#include "inline.hs"
1314
src/Streamly/Internal/Data/Stream/Ahead.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UndecidableInstances #-}
2+
13-- |
24-- Module : Streamly.Internal.Data.Stream.Ahead
35-- Copyright : (c) 2017 Harendra Kumar
src/Streamly/Internal/Data/Stream/Async.hs+4
@@ -1,3 +1,7 @@
1+{-# LANGUAGE UndecidableInstances #-}
2+
3+#include "inline.hs"
4+
15-- |
26-- Module : Streamly.Internal.Data.Stream.Async
37-- Copyright : (c) 2017 Harendra Kumar
src/Streamly/Internal/Data/Stream/Parallel.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UndecidableInstances #-}
2+
13#include "inline.hs"
24
35-- |
src/Streamly/Internal/Data/Stream/SVar.hs+2−4
@@ -51,7 +51,7 @@ import Test.Inspection (inspect, hasNoTypeClassesExcept)
5151
5252-- | Pull a stream from an SVar.
5353{-# NOINLINE fromStreamVar #-}
54−fromStreamVar :: forall m a . MonadAsync m => SVar Stream m a -> Stream m a
54+fromStreamVar :: MonadAsync m => SVar Stream m a -> Stream m a
5555fromStreamVar sv = MkStream $ \st yld sng stp -> do
5656 list <- readOutputQ sv
5757 -- Reversing the output is important to guarantee that we process the
@@ -60,7 +60,7 @@ fromStreamVar sv = MkStream $ \st yld sng stp -> do
6060 foldStream st yld sng stp $ processEvents $ reverse list
6161
6262 where
63− allDone :: m r -> m r
63+
6464 allDone stp = do
6565 when (svarInspectMode sv) $ do
6666 t <- liftIO $ getTime Monotonic
@@ -69,7 +69,6 @@ fromStreamVar sv = MkStream $ \st yld sng stp -> do
6969 stp
7070
7171 {-# INLINE processEvents #-}
72− processEvents :: [ChildEvent a] -> Stream m a
7372 processEvents [] = MkStream $ \st yld sng stp -> do
7473 done <- postProcess sv
7574 if done
@@ -93,7 +92,6 @@ fromStreamVar sv = MkStream $ \st yld sng stp -> do
9392 Just ThreadAbort ->
9493 foldStream st yld sng stp rest
9594 Nothing -> liftIO (cleanupSVar sv) >> throwM ex
96−
9795 shouldStop tid =
9896 case svarStopStyle sv of
9997 StopNone -> return False
src/Streamly/Internal/Data/Stream/Serial.hs+3
@@ -1,3 +1,6 @@
1+{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE UndecidableInstances #-}
3+
14-- |
25-- Module : Streamly.Internal.Data.Stream.Serial
36-- Copyright : (c) 2017 Harendra Kumar
src/Streamly/Internal/Data/Stream/StreamK.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UndecidableInstances #-}
2+
13#include "inline.hs"
24
35-- |
src/Streamly/Internal/Data/Stream/StreamK/Type.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UndecidableInstances #-}
2+
13#include "inline.hs"
24
35-- |
src/Streamly/Internal/Data/Stream/Zip.hs+3
@@ -1,3 +1,6 @@
1+{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE UndecidableInstances #-}
3+
14-- |
25-- Module : Streamly.Internal.Data.Stream.Zip
36-- Copyright : (c) 2017 Harendra Kumar
src/Streamly/Internal/Memory/Array.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UnboxedTuples #-}
2+
13#include "inline.hs"
24
35-- |
src/Streamly/Internal/Memory/Array/Types.hs+3
@@ -1,3 +1,6 @@
1+{-# LANGUAGE TypeFamilies #-}
2+{-# LANGUAGE UnboxedTuples #-}
3+
14#include "inline.hs"
25
36-- |
src/Streamly/Internal/Mutable/Prim/Var.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE UnboxedTuples #-}
2+
13#include "inline.hs"
24
35-- |
src/Streamly/Memory/Malloc.hs+2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE TypeFamilies #-}
2+
13#include "inline.hs"
24
35-- |
streamly.cabal+5−3
@@ -310,10 +310,12 @@ library
310310 RecordWildCards
311311 ScopedTypeVariables
312312 TupleSections
313− TypeFamilies
314− UnboxedTuples
315− UndecidableInstances
316313 ViewPatterns
314+
315+ -- UndecidableInstances -- Does not show any perf impact
316+ -- TypeFamilies -- Causes large regressions and improvements
317+ -- UnboxedTuples -- interferes with (#.)
318+
317319 if impl(ghc >= 8.1)
318320 default-extensions: TypeApplications
319321 if impl(ghc >= 8.6)