Copyright | (c) The University of Glasgow 2002 |
---|---|

License | see libraries/base/LICENSE |

Maintainer | ghc-devs@haskell.org |

Stability | internal |

Portability | non-portable (GHC Extensions) |

Safe Haskell | Trustworthy |

Language | Haskell2010 |

@since base-4.17.0.0

# Documentation

The `IsList`

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

@since base-4.7.0.0

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

IsList Version Source # | @since base-4.8.0.0 |

IsList CallStack Source # | Be aware that 'fromList . toList = id' only for unfrozen @since base-4.9.0.0 |

IsList (NonEmpty a) Source # | @since base-4.9.0.0 |

IsList (ZipList a) Source # | @since base-4.15.0.0 |

IsList [a] Source # | @since base-4.7.0.0 |