Hoogle Search

Within LTS Haskell 24.52 (ghc-9.10.3)

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

  1. toMap :: HashSet a -> HashMap a ()

    rio RIO.HashSet

    Convert to set to the equivalent HashMap with () values.

    >>> HashSet.toMap (HashSet.singleton 1)
    fromList [(1,())]
    

  2. concatMap :: Foldable t => (a -> [b]) -> t a -> [b]

    rio RIO.List

    Map a function over all the elements of a container and concatenate the resulting lists.

    Examples

    Basic usage:
    >>> concatMap (take 3) [[1..], [10..], [100..], [1000..]]
    [1,2,3,10,11,12,100,101,102,1000,1001,1002]
    
    >>> concatMap (take 3) (Just [1..])
    [1,2,3]
    

  3. foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m

    rio RIO.Map

    Fold the keys and values in the map using the given monoid, such that

    foldMapWithKey f = fold . mapWithKey f
    
    This can be an asymptotically faster than foldrWithKey or foldlWithKey for some monoids.

  4. isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool

    rio RIO.Map

    Is this a proper submap? (ie. a submap but not equal). Defined as (isProperSubmapOf = isProperSubmapOfBy (==)).

  5. isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool

    rio RIO.Map

    Is this a proper submap? (ie. a submap but not equal). The expression (isProperSubmapOfBy f m1 m2) returns True when keys m1 and keys m2 are not equal, all keys in m1 are in m2, and when f returns True when applied to their respective values. For example, the following expressions are all True:

    isProperSubmapOfBy (==) (fromList [(1,1)]) (fromList [(1,1),(2,2)])
    isProperSubmapOfBy (<=) (fromList [(1,1)]) (fromList [(1,1),(2,2)])
    
    But the following are all False:
    isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1),(2,2)])
    isProperSubmapOfBy (==) (fromList [(1,1),(2,2)]) (fromList [(1,1)])
    isProperSubmapOfBy (<)  (fromList [(1,1)])       (fromList [(1,1),(2,2)])
    

  6. isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool

    rio RIO.Map

    This function is defined as (isSubmapOf = isSubmapOfBy (==)).

  7. isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool

    rio RIO.Map

    The expression (isSubmapOfBy f t1 t2) returns True if all keys in t1 are in tree t2, and when f returns True when applied to their respective values. For example, the following expressions are all True:

    isSubmapOfBy (==) (fromList [('a',1)]) (fromList [('a',1),('b',2)])
    isSubmapOfBy (<=) (fromList [('a',1)]) (fromList [('a',1),('b',2)])
    isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1),('b',2)])
    
    But the following are all False:
    isSubmapOfBy (==) (fromList [('a',2)]) (fromList [('a',1),('b',2)])
    isSubmapOfBy (<)  (fromList [('a',1)]) (fromList [('a',1),('b',2)])
    isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1)])
    
    Note that isSubmapOfBy (_ _ -> True) m1 m2 tests whether all the keys in m1 are also keys in m2.

  8. biconcatMap :: Bifoldable t => (a -> [c]) -> (b -> [c]) -> t a b -> [c]

    rio RIO.Prelude

    Given a means of mapping the elements of a structure to lists, computes the concatenation of all such lists in order.

    Examples

    Basic usage:
    >>> biconcatMap (take 3) (fmap digitToInt) ([1..], "89")
    [1,2,3,8,9]
    
    >>> biconcatMap (take 3) (fmap digitToInt) (Left [1..])
    [1,2,3]
    
    >>> biconcatMap (take 3) (fmap digitToInt) (Right "89")
    [8,9]
    

  9. bifoldMap :: (Bifoldable p, Monoid m) => (a -> m) -> (b -> m) -> p a b -> m

    rio RIO.Prelude

    Combines the elements of a structure, given ways of mapping them to a common monoid.

    bifoldMap f g ≡ bifoldr (mappend . f) (mappend . g) mempty
    

    Examples

    Basic usage:
    >>> bifoldMap (take 3) (fmap digitToInt) ([1..], "89")
    [1,2,3,8,9]
    
    >>> bifoldMap (take 3) (fmap digitToInt) (Left [1..])
    [1,2,3]
    
    >>> bifoldMap (take 3) (fmap digitToInt) (Right "89")
    [8,9]
    

  10. bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d

    rio RIO.Prelude

    Map over both arguments at the same time.

    bimap f g ≡ first f . second g
    

    Examples

    >>> bimap toUpper (+1) ('j', 3)
    ('J',4)
    
    >>> bimap toUpper (+1) (Left 'j')
    Left 'J'
    
    >>> bimap toUpper (+1) (Right 3)
    Right 4
    

Page 492 of many | Previous | Next