Commit 1f911de4 authored by Brian Wignall's avatar Brian Wignall Committed by Marge Bot

Add IsList instance for ZipList (closes #17433)

parent 1f98e47d
...@@ -113,6 +113,8 @@ import Data.Ord ...@@ -113,6 +113,8 @@ import Data.Ord
import Data.Version ( Version(..), makeVersion ) import Data.Version ( Version(..), makeVersion )
import qualified Debug.Trace import qualified Debug.Trace
import Control.Applicative (ZipList(..))
-- XXX This should really be in Data.Tuple, where the definitions are -- XXX This should really be in Data.Tuple, where the definitions are
maxTupleSize :: Int maxTupleSize :: Int
maxTupleSize = 62 maxTupleSize = 62
...@@ -209,6 +211,12 @@ instance IsList [a] where ...@@ -209,6 +211,12 @@ instance IsList [a] where
fromList = id fromList = id
toList = id toList = id
-- | @since
instance IsList (ZipList a) where
type (Item (ZipList a)) = a
fromList = ZipList
toList (ZipList as) = as
-- | @since 4.9.0.0 -- | @since 4.9.0.0
instance IsList (NonEmpty a) where instance IsList (NonEmpty a) where
type Item (NonEmpty a) = a type Item (NonEmpty a) = a
...@@ -261,7 +269,7 @@ atomicModifyMutVar# mv f s = ...@@ -261,7 +269,7 @@ atomicModifyMutVar# mv f s =
-- 'SmallMutableArray#' is either the original 'SmallMutableArray#' -- 'SmallMutableArray#' is either the original 'SmallMutableArray#'
-- resized in-place or, if not possible, a newly allocated -- resized in-place or, if not possible, a newly allocated
-- 'SmallMutableArray#' with the original content copied over. -- 'SmallMutableArray#' with the original content copied over.
-- --
-- To avoid undefined behaviour, the original 'SmallMutableArray#' shall -- To avoid undefined behaviour, the original 'SmallMutableArray#' shall
-- not be accessed anymore after a 'resizeSmallMutableArray#' has been -- not be accessed anymore after a 'resizeSmallMutableArray#' has been
-- performed. Moreover, no reference to the old one should be kept in order -- performed. Moreover, no reference to the old one should be kept in order
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment