Hoogle Search
Within LTS Haskell 24.6 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
fromDistinctAscList :: Enum k => [k] -> EnumSet kenummapset Data.EnumSet No documentation available.
fromList :: Enum k => [k] -> EnumSet kenummapset Data.EnumSet No documentation available.
toAscList :: Enum k => EnumSet k -> [k]enummapset Data.EnumSet No documentation available.
toDescList :: Enum k => EnumSet k -> [k]enummapset Data.EnumSet No documentation available.
toList :: Enum k => EnumSet k -> [k]enummapset Data.EnumSet No documentation available.
toList :: Foldable t => t a -> [a]ghc-internal GHC.Internal.Data.Foldable List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.
Examples
Basic usage:>>> toList Nothing []
>>> toList (Just 42) [42]
>>> toList (Left "foo") []
>>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8))) [5,17,12,8]
For lists, toList is the identity:>>> toList [1, 2, 3] [1,2,3]
-
ghc-internal GHC.Internal.Data.Maybe The maybeToList function returns an empty list when given Nothing or a singleton list when given Just.
Examples
Basic usage:>>> maybeToList (Just 7) [7]
>>> maybeToList Nothing []
One can use maybeToList to avoid pattern matching when combined with a function that (safely) works on lists:>>> import GHC.Internal.Text.Read ( readMaybe ) >>> sum $ maybeToList (readMaybe "3") 3 >>> sum $ maybeToList (readMaybe "") 0
module GHC.Internal.Data.
OldList Operations on lists.
fromList :: Manifest r e => Comp -> [e] -> Vector r emassiv Data.Massiv.Array Convert a flat list into a vector
-
massiv Data.Massiv.Array Same as fromListsM, but will throw an error on irregular shaped lists. Note: This function is the same as if you would turn on {-# LANGUAGE OverloadedLists #-} extension. For that reason you can also use fromList.
\xs -> fromLists' Seq xs == (fromList Seq xs :: Vector P Int)
Examples
Convert a list of lists into a 2D Array>>> import Data.Massiv.Array as A >>> fromLists' Seq [[1,2,3],[4,5,6]] :: Array U Ix2 Int Array U Seq (Sz (2 :. 3)) [ [ 1, 2, 3 ] , [ 4, 5, 6 ] ]
Above example implemented using GHC's OverloadedLists extension:>>> :set -XOverloadedLists >>> [[1,2,3],[4,5,6]] :: Array U Ix2 Int Array U Seq (Sz (2 :. 3)) [ [ 1, 2, 3 ] , [ 4, 5, 6 ] ]