base-4.18.2.1: Core data structures and operations
Copyright(c) The University of Glasgow 2002
Licensesee libraries/base/LICENSE
Maintainercvs-ghc@haskell.org
Stabilityinternal
Portabilitynon-portable (GHC Extensions)
Safe HaskellTrustworthy
LanguageHaskell2010

GHC.IsList

Description

Since: base-4.17.0.0

Synopsis

Documentation

class IsList l where Source #

The IsList class and its methods are intended to be used in conjunction with the OverloadedLists extension.

Since: base-4.7.0.0

Minimal complete definition

fromList, toList

Associated Types

type Item l Source #

The Item type function returns the type of items of the structure l.

Methods

fromList :: [Item l] -> l Source #

The fromList function constructs the structure l from the given list of Item l

fromListN :: Int -> [Item l] -> l Source #

The fromListN function takes the input list's length and potentially uses it to construct the structure l more efficiently compared to fromList. If the given number does not equal to the input list's length the behaviour of fromListN is not specified.

fromListN (length xs) xs == fromList xs

toList :: l -> [Item l] Source #

The toList function extracts a list of Item l from the structure l. It should satisfy fromList . toList = id.

Instances

Instances details
IsList ByteArray Source #

Since: base-4.17.0.0

Instance details

Defined in Data.Array.Byte

Associated Types

type Item ByteArray Source #

IsList Version Source #

Since: base-4.8.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item Version Source #

IsList CallStack Source #

Be aware that 'fromList . toList = id' only for unfrozen CallStacks, since toList removes frozenness information.

Since: base-4.9.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item CallStack Source #

IsList (ZipList a) Source #

Since: base-4.15.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item (ZipList a) Source #

Methods

fromList :: [Item (ZipList a)] -> ZipList a Source #

fromListN :: Int -> [Item (ZipList a)] -> ZipList a Source #

toList :: ZipList a -> [Item (ZipList a)] Source #

IsList (NonEmpty a) Source #

Since: base-4.9.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item (NonEmpty a) Source #

IsList [a] Source #

Since: base-4.7.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item [a] Source #

Methods

fromList :: [Item [a]] -> [a] Source #

fromListN :: Int -> [Item [a]] -> [a] Source #

toList :: [a] -> [Item [a]] Source #