@@ -79,6 +79,7 @@ where
7979
8080import Control.Exception (assert)
8181import Control.DeepSeq (NFData(..), NFData1(..))
82+import Control.Monad (replicateM)
8283import Control.Monad.IO.Class (MonadIO(..))
8384import Data.Functor.Identity (Identity(..))
8485import Data.Word (Word8)
@@ -92,7 +93,7 @@ import Streamly.Internal.Data.Fold.Type (Fold(..))
9293import Streamly.Internal.Data.Stream.Type (Stream)
9394import Streamly.Internal.Data.Unboxed (Unbox, peekWith, sizeOf)
9495import Streamly.Internal.Data.Unfold.Type (Unfold(..))
95−import Text.Read (readPrec, readListPrec, readListPrecDefault)
96+import Text.Read (readPrec)
9697
9798import Prelude hiding (length, foldr, read, unlines, splitAt)
9899
@@ -103,6 +104,7 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
103104import qualified Streamly.Internal.Data.Stream.Type as Stream
104105import qualified Streamly.Internal.Data.Unboxed as Unboxed
105106import qualified Streamly.Internal.Data.Unfold.Type as Unfold
107+import qualified Text.ParserCombinators.ReadPrec as ReadPrec
106108
107109import Streamly.Internal.System.IO (unsafeInlineIO, defaultChunkSize)
108110
@@ -481,13 +483,16 @@ write = fmap unsafeFreeze MA.write
481483-------------------------------------------------------------------------------
482484
483485instance (Show a, Unbox a) => Show (Array a) where
484− {-# INLINE showsPrec #-}
485− showsPrec _ = shows . toList
486+ {-# INLINE show #-}
487+ show arr = "fromList " ++ show (toList arr)
486488
487489instance (Unbox a, Read a, Show a) => Read (Array a) where
488490 {-# INLINE readPrec #-}
489− readPrec = fromList <$> readPrec
490− readListPrec = readListPrecDefault
491+ readPrec = do
492+ fromListWord <- replicateM 9 ReadPrec.get
493+ if fromListWord == "fromList "
494+ then fromList <$> readPrec
495+ else ReadPrec.pfail
491496
492497instance (a ~ Char) => IsString (Array a) where
493498 {-# INLINE fromString #-}