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.
adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k ario RIO.Map Adjust a value at a specific key. When the key is not a member of the map, the original map is returned.
let f key x = (show key) ++ ":new " ++ x adjustWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")] adjustWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")] adjustWithKey f 7 empty == empty
fromJust :: HasCallStack => Maybe a -> ario RIO.Partial The fromJust function extracts the element out of a Just and throws an error if its argument is Nothing.
Examples
Basic usage:>>> fromJust (Just 1) 1
>>> 2 * (fromJust (Just 10)) 20
>>> 2 * (fromJust Nothing) *** Exception: Maybe.fromJust: Nothing ...
WARNING: This function is partial. You can use case-matching instead.-
rio RIO.Prelude The isJust function returns True iff its argument is of the form Just _.
Examples
Basic usage:>>> isJust (Just 3) True
>>> isJust (Just ()) True
>>> isJust Nothing False
Only the outer constructor is taken into consideration:>>> isJust (Just Nothing) True
adjust :: (a -> a) -> Int -> Seq a -> Seq ario RIO.Seq Update the element at the specified position. If the position is out of range, the original sequence is returned. adjust can lead to poor performance and even memory leaks, because it does not force the new value before installing it in the sequence. adjust' should usually be preferred.
adjust' :: (a -> a) -> Int -> Seq a -> Seq ario RIO.Seq Update the element at the specified position. If the position is out of range, the original sequence is returned. The new value is forced before it is installed in the sequence.
adjust' f i xs = case xs !? i of Nothing -> xs Just x -> let !x' = f x in update i x' xs
findJustDef :: a -> (a -> Bool) -> [a] -> aerrors Control.Error No documentation available.
fromJustDef :: a -> Maybe a -> aerrors Control.Error An alternative name for fromMaybe, to fit the naming scheme of this package. Generally using fromMaybe directly would be considered better style.
-
errors Control.Error The isJust function returns True iff its argument is of the form Just _.
Examples
Basic usage:>>> isJust (Just 3) True
>>> isJust (Just ()) True
>>> isJust Nothing False
Only the outer constructor is taken into consideration:>>> isJust (Just Nothing) True
lookupJustDef :: Eq a => b -> a -> [(a, b)] -> berrors Control.Error No documentation available.
tryJust :: forall (m :: Type -> Type) e a . Monad m => e -> Maybe a -> ExceptT e m aerrors Control.Error.Safe A fromJust that fails in the ExceptT monad