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.

  1. fromListsM :: forall r ix e m . (Ragged L ix e, Manifest r e, MonadThrow m) => Comp -> [ListItem ix e] -> m (Array r ix e)

    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)
    

  2. toList :: (Index ix, Source r e) => Array r ix e -> [e]

    massiv Data.Massiv.Array

    Convert any array to a flat list.

    Examples

    >>> import Data.Massiv.Array
    
    >>> toList $ makeArrayR U Seq (Sz (2 :. 3)) fromIx2
    [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2)]
    

  3. toLists :: (Ragged L ix e, Shape r ix, Source r e) => Array r ix e -> [ListItem ix e]

    massiv Data.Massiv.Array

    O(n) - Convert an array into a nested list. Number of array dimensions and list nestedness will always match, but you can use toList, toLists2, etc. if flattening of inner dimensions is desired. Note: This function is almost the same as toList.

    Examples

    >>> import Data.Massiv.Array
    
    >>> arr = makeArrayR U Seq (Sz (2 :> 1 :. 3)) id
    
    >>> arr
    Array U Seq (Sz (2 :> 1 :. 3))
    [ [ [ 0 :> 0 :. 0, 0 :> 0 :. 1, 0 :> 0 :. 2 ]
    ]
    , [ [ 1 :> 0 :. 0, 1 :> 0 :. 1, 1 :> 0 :. 2 ]
    ]
    ]
    
    >>> toLists arr
    [[[0 :> 0 :. 0,0 :> 0 :. 1,0 :> 0 :. 2]],[[1 :> 0 :. 0,1 :> 0 :. 1,1 :> 0 :. 2]]]
    

  4. toLists2 :: (Source r e, Index ix, Index (Lower ix)) => Array r ix e -> [[e]]

    massiv Data.Massiv.Array

    Convert an array with at least 2 dimensions into a list of lists. Inner dimensions will get flattened.

    Examples

    >>> import Data.Massiv.Array
    
    >>> toLists2 $ makeArrayR U Seq (Sz2 2 3) fromIx2
    [[(0,0),(0,1),(0,2)],[(1,0),(1,1),(1,2)]]
    
    >>> toLists2 $ makeArrayR U Seq (Sz3 2 1 3) fromIx3
    [[(0,0,0),(0,0,1),(0,0,2)],[(1,0,0),(1,0,1),(1,0,2)]]
    

  5. toLists3 :: (Source r e, Index ix, Index (Lower ix), Index (Lower (Lower ix))) => Array r ix e -> [[[e]]]

    massiv Data.Massiv.Array

    Convert an array with at least 3 dimensions into a 3 deep nested list. Inner dimensions will get flattened.

  6. toLists4 :: (Source r e, Index ix, Index (Lower ix), Index (Lower (Lower ix)), Index (Lower (Lower (Lower ix)))) => Array r ix e -> [[[[e]]]]

    massiv Data.Massiv.Array

    Convert an array with at least 4 dimensions into a 4 deep nested list. Inner dimensions will get flattened.

  7. unsafeFromListN :: Sz1 -> [e] -> Vector DS e

    massiv Data.Massiv.Array.Unsafe

    O(n) - Convert a list of a known length to a delayed stream vector. Unsafe - This function is unsafe because it will allocate enough space in memory for n elements ahead of time, regardless of the actual size of the list. Supplying n that is too big will result in an asynchronous HeapOverflow exception.

  8. unList :: List ix e -> [Elt ix e]

    massiv Data.Massiv.Core

    No documentation available.

  9. showArrayList :: Show arr => [arr] -> String -> String

    massiv Data.Massiv.Core.List

    Helper function for declaring Show instances for arrays

  10. toListArray :: (Ragged L ix e, Shape r ix, Source r e) => Array r ix e -> Array L ix e

    massiv Data.Massiv.Core.List

    Construct an array backed by linked lists from any source array

Page 95 of many | Previous | Next