Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- newtype UnlinedText = UnsafeUnlinedText {}
- fromText :: Text -> List UnlinedText
- fromTextReplace :: Text -> UnlinedText
- unsafeUnlinedText :: HasCallStack => Text -> UnlinedText
- toText :: List UnlinedText -> Text
- concat :: List UnlinedText -> UnlinedText
- intercalate :: UnlinedText -> List UnlinedText -> UnlinedText
- reallyUnsafeLiftUnlined :: (Text -> Text) -> UnlinedText -> UnlinedText
Documentation
newtype UnlinedText Source #
Text after it has had all lines separated into different texts. We introduce a newtype for clarity. The idea is that when we read arbitrary text from a handle, this type serves as a witness that we have indeed split the string along newlines. Then, in the normal case, we log each line separately.
In exceptional cases (e.g. command names), we may choose to combine the list back into a single text, according to some logic.
The constructor UnsafeUnlinedText
should only be used when we know
the text has no newlines and performance means a branch is undesirable
(e.g. streaming). If there is no performance impact, consider
unsafeUnlinedText
instead.
Instances
IsString UnlinedText Source # | |
Defined in Shrun.Data.Text fromString :: String -> UnlinedText # | |
Monoid UnlinedText Source # | |
Defined in Shrun.Data.Text mempty :: UnlinedText # mappend :: UnlinedText -> UnlinedText -> UnlinedText # mconcat :: [UnlinedText] -> UnlinedText # | |
Semigroup UnlinedText Source # | |
Defined in Shrun.Data.Text (<>) :: UnlinedText -> UnlinedText -> UnlinedText # sconcat :: NonEmpty UnlinedText -> UnlinedText # stimes :: Integral b => b -> UnlinedText -> UnlinedText # | |
Show UnlinedText Source # | |
Defined in Shrun.Data.Text showsPrec :: Int -> UnlinedText -> ShowS # show :: UnlinedText -> String # showList :: [UnlinedText] -> ShowS # | |
Eq UnlinedText Source # | |
Defined in Shrun.Data.Text (==) :: UnlinedText -> UnlinedText -> Bool # (/=) :: UnlinedText -> UnlinedText -> Bool # | |
(k ~ A_Getter, a ~ Text, b ~ Text) => LabelOptic "unUnlinedText" k UnlinedText UnlinedText a b Source # | |
Defined in Shrun.Data.Text labelOptic :: Optic k NoIx UnlinedText UnlinedText a b Source # |
Creation
fromText :: Text -> List UnlinedText Source #
Creates a list of UnlinedText
.
fromTextReplace :: Text -> UnlinedText Source #
Creates a single UnlinedText
by replacing newlines with
whitespace.
unsafeUnlinedText :: HasCallStack => Text -> UnlinedText Source #
Unsafe creation that throws error when the text contains newline(s).
Elimination
Functions
concat :: List UnlinedText -> UnlinedText Source #
Concats via toText
.
intercalate :: UnlinedText -> List UnlinedText -> UnlinedText Source #
reallyUnsafeLiftUnlined :: (Text -> Text) -> UnlinedText -> UnlinedText Source #
Lifts a Text
function to UnlinedText
. Very unsafe in that we do not
check for errors i.e. if the parameter function introduces any newlines,
then this will silently succeed. This exists for performance.