Hoogle Search

Within LTS Haskell 24.20 (ghc-9.10.3)

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

  1. adjustWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map) -> ContainerKey map -> map -> map

    mono-traversable Data.Containers

    Equivalent to adjustMap, but the function accepts the key, as well as the previous value.

  2. fromJust :: Maybe a -> a

    strict Data.Strict.Maybe

    Extracts the element out of a Just and throws an error if the argument is Nothing.

  3. isJust :: Maybe a -> Bool

    strict Data.Strict.Maybe

    Yields True iff the argument is of the form Just _.

  4. untilJust :: Monad m => m (Maybe a) -> m a

    monad-loops Control.Monad.Loops

    Run the supplied Maybe computation repeatedly until it returns a value. Returns that value.

  5. whileJust :: Monad m => m (Maybe a) -> (a -> m b) -> m [b]

    monad-loops Control.Monad.Loops

    As long as the supplied Maybe expression returns "Just _", the loop body will be called and passed the value contained in the Just. Results are collected into a list.

  6. whileJust' :: (Monad m, MonadPlus f) => m (Maybe a) -> (a -> m b) -> m (f b)

    monad-loops Control.Monad.Loops

    As long as the supplied Maybe expression returns "Just _", the loop body will be called and passed the value contained in the Just. Results are collected into an arbitrary MonadPlus container.

  7. whileJust_ :: Monad m => m (Maybe a) -> (a -> m b) -> m ()

    monad-loops Control.Monad.Loops

    As long as the supplied Maybe expression returns "Just _", the loop body will be called and passed the value contained in the Just. Results are discarded.

  8. adjust :: (Eq k, Hashable k) => (v -> v) -> k -> HashMap k v -> HashMap k v

    rio RIO.HashMap

    Adjust the value tied to a given key in this map only if it is present. Otherwise, leave the map alone.

  9. _Just :: forall a a' f . Applicative f => (a -> f a') -> Maybe a -> f (Maybe a')

    rio RIO.Lens

    _Just targets the value contained in a Maybe, provided it's a Just. See documentation for _Left (as these 2 are pretty similar). In particular, it can be used to write these:

    • Unsafely extracting a value from a Just:
    fromJust = (^?! _Just)
    
    
    • Checking whether a value is a Just:
    isJust = has _Just
    
    
    • Converting a Maybe to a list (empty or consisting of a single element):
    maybeToList = (^.. _Just)
    
    
    • Gathering all Justs in a list:
    catMaybes = (^.. each . _Just)
    
    

  10. adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a

    rio RIO.Map

    Update a value at a specific key with the result of the provided function. When the key is not a member of the map, the original map is returned.

    adjust ("new " ++) 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")]
    adjust ("new " ++) 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]
    adjust ("new " ++) 7 empty                         == empty
    

Page 40 of many | Previous | Next