Hoogle Search

Within LTS Haskell 24.66 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. concatMap :: (a -> [b]) -> [a] -> [b]

    base GHC.List

    Map a function returning a list over a list and concatenate the results. concatMap can be seen as the composition of concat and map.

    concatMap f xs == (concat . map f) xs
    

    Examples

    >>> concatMap (\i -> [-i,i]) []
    []
    
    >>> concatMap (\i -> [-i, i]) [1, 2, 3]
    [-1,1,-2,2,-3,3]
    
    >>> concatMap ('replicate' 3) [0, 2, 4]
    [0,0,0,2,2,2,4,4,4]
    

  2. concatMap :: (Word8 -> ByteString) -> ByteString -> ByteString

    bytestring Data.ByteString

    Map a function over a ByteString and concatenate the results

  3. primMapByteStringBounded :: BoundedPrim Word8 -> StrictByteString -> Builder

    bytestring Data.ByteString.Builder.Prim

    Create a Builder that encodes each Word8 of a StrictByteString using a BoundedPrim. For example, we can write a Builder that filters a StrictByteString as follows.

    import qualified Data.ByteString.Builder.Prim as P
    
    filterBS p = P.condB p (P.liftFixedToBounded P.word8) P.emptyB
    

  4. primMapByteStringFixed :: FixedPrim Word8 -> StrictByteString -> Builder

    bytestring Data.ByteString.Builder.Prim

    Heavy inlining. Encode all bytes of a StrictByteString from left-to-right with a FixedPrim. This function is quite versatile. For example, we can use it to construct a Builder that maps every byte before copying it to the buffer to be filled.

    mapToBuilder :: (Word8 -> Word8) -> S.StrictByteString -> Builder
    mapToBuilder f = primMapByteStringFixed (contramapF f word8)
    
    We can also use it to hex-encode a StrictByteString as shown by the byteStringHex example above.

  5. primMapLazyByteStringBounded :: BoundedPrim Word8 -> LazyByteString -> Builder

    bytestring Data.ByteString.Builder.Prim

    Chunk-wise application of primMapByteStringBounded.

  6. primMapLazyByteStringFixed :: FixedPrim Word8 -> LazyByteString -> Builder

    bytestring Data.ByteString.Builder.Prim

    Heavy inlining. Encode all bytes of a LazyByteString from left-to-right with a FixedPrim.

  7. primMapListBounded :: BoundedPrim a -> [a] -> Builder

    bytestring Data.ByteString.Builder.Prim

    Create a Builder that encodes a list of values consecutively using a BoundedPrim for each element. This function is more efficient than

    mconcat . map (primBounded w)
    
    or
    foldMap (primBounded w)
    
    because it moves several variables out of the inner loop.

  8. primMapListFixed :: FixedPrim a -> [a] -> Builder

    bytestring Data.ByteString.Builder.Prim

    Encode a list of values from left-to-right with a FixedPrim.

  9. contramapB :: (b -> a) -> BoundedPrim a -> BoundedPrim b

    bytestring Data.ByteString.Builder.Prim.Internal

    Change a BoundedPrim such that it first applies a function to the value to be encoded. Note that BoundedPrims are Contravariant http://hackage.haskell.org/package/contravariant. Hence, the following laws hold.

    contramapB id = id
    contramapB f . contramapB g = contramapB (g . f)
    

  10. contramapF :: (b -> a) -> FixedPrim a -> FixedPrim b

    bytestring Data.ByteString.Builder.Prim.Internal

    Change a primitives such that it first applies a function to the value to be encoded. Note that primitives are Contravariant http://hackage.haskell.org/package/contravariant. Hence, the following laws hold.

    contramapF id = id
    contramapF f . contramapF g = contramapF (g . f)
    

Page 402 of many | Previous | Next