Hoogle Search
Within LTS Haskell 24.3 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
fromListWith :: Enum k => (a -> a -> a) -> [(k, a)] -> EnumMap k aenummapset Data.EnumMap.Strict No documentation available.
fromListWithKey :: Enum k => (k -> a -> a -> a) -> [(k, a)] -> EnumMap k aenummapset Data.EnumMap.Strict No documentation available.
-
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 ] ]
-
massiv Data.Massiv.Array O(n) - Convert a nested list into an array. Nested list must be of a rectangular shape, otherwise a runtime error will occur. Also, nestedness must match the rank of resulting array, which should be specified through an explicit type signature.
Examples
>>> import Data.Massiv.Array as A >>> fromListsM Seq [[1,2,3],[4,5,6]] :: Maybe (Array U Ix2 Int) Just (Array U Seq (Sz (2 :. 3)) [ [ 1, 2, 3 ] , [ 4, 5, 6 ] ] )
>>> fromListsM Par [[[1,2,3]],[[4,5,6]]] :: Maybe (Array U Ix3 Int) Just (Array U Par (Sz (2 :> 1 :. 3)) [ [ [ 1, 2, 3 ] ] , [ [ 4, 5, 6 ] ] ] )
Elements of a boxed array could be lists themselves if necessary, but cannot be ragged:>>> fromListsM Seq [[[1,2,3]],[[4,5]]] :: Maybe (Array B Ix2 [Int]) Just (Array B Seq (Sz (2 :. 1)) [ [ [1,2,3] ] , [ [4,5] ] ] ) >>> fromListsM Seq [[[1,2,3]],[[4,5]]] :: Maybe (Array B Ix3 Integer) Nothing >>> fromListsM Seq [[[1,2,3]],[[4,5,6],[7,8,9]]] :: IO (Array B Ix3 Integer) *** Exception: DimTooLongException for (Dim 2): expected (Sz1 1), got (Sz1 2) >>> fromListsM Seq [[1,2,3,4],[5,6,7]] :: IO (Matrix B Integer) *** Exception: DimTooShortException for (Dim 1): expected (Sz1 4), got (Sz1 3)
fromListN :: IsList l => Int -> [Item l] -> lghc-internal GHC.Internal.Exts 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
fromListN :: IsList l => Int -> [Item l] -> lghc-internal GHC.Internal.IsList 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
fromListIO :: forall (m :: MutabilityType Type) . [JSVal] -> JSM (SomeJSArray m)jsaddle JavaScript.Array No documentation available.
fromListIO :: forall (m :: MutabilityType Type) . [JSVal] -> JSM (SomeJSArray m)jsaddle JavaScript.Array.Internal No documentation available.
fromListIO :: forall (m :: MutabilityType Type) . [JSVal] -> JSM (SomeJSArray m)jsaddle Language.Javascript.JSaddle.Object No documentation available.
fromListN :: IsList l => Int -> [Item l] -> lnumhask NumHask.Prelude 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