Just

Just :: a -> Maybe a
base Prelude, base Data.Maybe
justifyLeft :: Int -> Char -> Text -> Text
text Data.Text
O(n) Left-justify a string to the given length, using the specified fill character on the right. Subject to fusion. Performs replacement on invalid scalar values. Examples: > justifyLeft 7 'x' "foo" == "fooxxxx" > justifyLeft 3 'x' "foobar" == "foobar"
justifyLeft :: Int64 -> Char -> Text -> Text
text Data.Text.Lazy
O(n) Left-justify a string to the given length, using the specified fill character on the right. Subject to fusion. Performs replacement on invalid scalar values. Examples: > justifyLeft 7 'x' "foo" == "fooxxxx" > justifyLeft 3 'x' "foobar" == "foobar"
justifyRight :: Int -> Char -> Text -> Text
text Data.Text
O(n) Right-justify a string to the given length, using the specified fill character on the left. Performs replacement on invalid scalar values. Examples: > justifyRight 7 'x' "bar" == "xxxxbar" > justifyRight 3 'x' "foobar" == "foobar"
justifyRight :: Int64 -> Char -> Text -> Text
text Data.Text.Lazy
O(n) Right-justify a string to the given length, using the specified fill character on the left. Performs replacement on invalid scalar values. Examples: > justifyRight 7 'x' "bar" == "xxxxbar" > justifyRight 3 'x' "foobar" == "foobar"
catchJust :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a
base Control.OldException
The function catchJust is like catch, but it takes an extra argument which is an exception predicate, a function which selects which type of exceptions we're interested in. There are some predefined exception predicates for useful subsets of exceptions: ioErrors, arithExceptions, and so on. For example, to catch just calls to the error function, we could use > result <- catchJust errorCalls thing_to_try handler Any other exceptions which are not matched by the predicate are re-raised, and may be caught by an enclosing catch or catchJust.
catchJust :: Exception e => (e -> Maybe b) -> IO a -> (b -> IO a) -> IO a
base Control.Exception.Base, base Control.Exception
The function catchJust is like catch, but it takes an extra argument which is an exception predicate, a function which selects which type of exceptions we're interested in. > catchJust (\e -> if isDoesNotExistErrorType (ioeGetErrorType e) then Just () else Nothing) > (readFile f) > (\_ -> do hPutStrLn stderr ("No such file: " ++ show f) > return "") Any other exceptions which are not matched by the predicate are re-raised, and may be caught by an enclosing catch, catchJust, etc.
fromJust :: Maybe a -> a
base Data.Maybe
The fromJust function extracts the element out of a Just and throws an error if its argument is Nothing.
handleJust :: (Exception -> Maybe b) -> (b -> IO a) -> IO a -> IO a
base Control.OldException
A version of catchJust with the arguments swapped around (see handle).
handleJust :: Exception e => (e -> Maybe b) -> (b -> IO a) -> IO a -> IO a
base Control.Exception.Base, base Control.Exception
A version of catchJust with the arguments swapped around (see handle).
isJust :: Maybe a -> Bool
base Data.Maybe
The isJust function returns True iff its argument is of the form Just _.
tryJust :: (Exception -> Maybe b) -> IO a -> IO (Either b a)
base Control.OldException
A variant of try that takes an exception predicate to select which exceptions are caught (c.f. catchJust). If the exception does not match the predicate, it is re-thrown.
tryJust :: Exception e => (e -> Maybe b) -> IO a -> IO (Either b a)
base Control.Exception.Base, base Control.Exception
A variant of try that takes an exception predicate to select which exceptions are caught (c.f. catchJust). If the exception does not match the predicate, it is re-thrown.
adjust :: (a -> a) -> Int -> Seq a -> Seq a
containers Data.Sequence
O(log(min(i,n-i))). Update the element at the specified position. If the position is out of range, the original sequence is returned.
adjust :: (a -> a) -> Key -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(min(n,W)). Adjust a value at a specific key. 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
adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a
containers Data.Map.Lazy, containers Data.Map.Strict
O(log n). 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
adjustWithKey :: (Key -> a -> a) -> Key -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(min(n,W)). 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
adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a
containers Data.Map.Lazy, containers Data.Map.Strict
O(log n). 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
bufferAdjustL :: Int -> Buffer e -> Buffer e
base GHC.IO.Buffer