Hoogle Search
Within LTS Haskell 24.64 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
justThis :: These a b -> Maybe athese Data.These.Combinators No documentation available.
justifyLeft :: Int -> Char -> Text -> Textrio RIO.Text O(n) Left-justify a string to the given length, using the specified fill character on the right. Performs replacement on invalid scalar values. Examples:
>>> justifyLeft 7 'x' "foo" "fooxxxx"
>>> justifyLeft 3 'x' "foobar" "foobar"
justifyRight :: Int -> Char -> Text -> Textrio RIO.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"
justifyLeft :: Int64 -> Char -> Text -> Textrio RIO.Text.Lazy O(n) Left-justify a string to the given length, using the specified fill character on the right. Performs replacement on invalid scalar values. Examples:
justifyLeft 7 'x' "foo" == "fooxxxx" justifyLeft 3 'x' "foobar" == "foobar"
justifyRight :: Int64 -> Char -> Text -> Textrio RIO.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"
justVarInterpolation :: ShakespeareSettings -> Boolshakespeare Text.Shakespeare No documentation available.
justErr :: e -> Maybe a -> Either e aerrors Control.Error.Safe A fromJust that fails in the Either monad
justZ :: MonadPlus m => Maybe a -> m aerrors Control.Error.Safe A fromJust that fails using mzero
justifyLeft :: Word -> Char -> Buffer % 1 -> Buffertext-builder-linear Data.Text.Builder.Linear.Buffer Pad a builder from the right side to the specified length with the specified character.
>>> :set -XLinearTypes >>> runBuffer (\b -> justifyLeft 10 'x' (appendChars 3 'A' b)) "AAAxxxxxxx" >>> runBuffer (\b -> justifyLeft 5 'x' (appendChars 6 'A' b)) "AAAAAA"
Note that newEmptyBuffer is needed in some situations. See justifyRight for an example. Warning: In contrast to singleton, it is the responsibility of the caller to sanitize surrogate code points with safe.justifyRight :: Word -> Char -> Buffer % 1 -> Buffertext-builder-linear Data.Text.Builder.Linear.Buffer Pad a builder from the left side to the specified length with the specified character.
>>> :set -XLinearTypes >>> runBuffer (\b -> justifyRight 10 'x' (appendChars 3 'A' b)) "xxxxxxxAAA" >>> runBuffer (\b -> justifyRight 5 'x' (appendChars 6 'A' b)) "AAAAAA"
Note that newEmptyBuffer is needed in some situations. The following example creates a utility function that justify a text and then append it to a buffer.>>> :set -XOverloadedStrings -XLinearTypes -XUnboxedTuples >>> import Data.Text.Builder.Linear.Buffer >>> import Data.Text (Text) >>> :{ appendJustified :: Buffer %1 -> Text -> Buffer appendJustified b t = case newEmptyBuffer b of -- Note that we need to create a new buffer from the text, in order -- to justify only the text and not the input buffer. (# b', empty #) -> b' >< justifyRight 12 ' ' (empty |> t) :}>>> runBuffer (\b -> (b |> "Test:") `appendJustified` "AAA" `appendJustified` "BBBBBBB") "Test: AAA BBBBBBB"
Warning: In contrast to singleton, it is the responsibility of the caller to sanitize surrogate code points with safe.