HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebasement-0.0.16Haskell2010

Basement.Compat.IsList

compat friendly version of IsList

  • 1 class
  • Packagebasement-0.0.16
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIsList.hs
classclass IsList l where
#

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

Associated types

  • type family Item l

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

Methods

  • fromList :: [Item l] -> l

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

  • fromListN :: Int -> [Item l] -> l

    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.

    Property
    fromListN (length xs) xs == fromList xs
  • toList :: l -> [Item l]

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

Instances12IsList, …
  • IsList ByteArrayDefined in base-4.20.2.0 · Data.Array.Byte
  • IsList AsciiStringDefined in basement-0.0.16 · Basement.Types.AsciiString
  • IsList StringDefined in basement-0.0.16 · Basement.UTF8.Base
  • IsList VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList CallStackDefined in ghc-internal-9.1003.0 · GHC.Internal.IsList

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

  • PrimType ty => IsList (Block ty)Defined in basement-0.0.16 · Basement.Block.Base
  • PrimType ty => IsList (UArray ty)Defined in basement-0.0.16 · Basement.UArray.Base
  • IsList (Array ty)Defined in basement-0.0.16 · Basement.BoxedArray
  • IsList (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.IsList
  • IsList c => IsList (NonEmpty c)Defined in basement-0.0.16 · Basement.NonEmpty