shrun-0.9: A utility program for running shell commands concurrently.
Safe HaskellNone
LanguageGHC2021

Shrun.Data.Text

Synopsis

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.

Constructors

UnsafeUnlinedText 

Fields

Instances

Instances details
IsString UnlinedText Source # 
Instance details

Defined in Shrun.Data.Text

Monoid UnlinedText Source # 
Instance details

Defined in Shrun.Data.Text

Semigroup UnlinedText Source # 
Instance details

Defined in Shrun.Data.Text

Show UnlinedText Source # 
Instance details

Defined in Shrun.Data.Text

Eq UnlinedText Source # 
Instance details

Defined in Shrun.Data.Text

(k ~ A_Getter, a ~ Text, b ~ Text) => LabelOptic "unUnlinedText" k UnlinedText UnlinedText a b Source # 
Instance details

Defined in Shrun.Data.Text

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

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.