HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleturtle-1.6.2Haskell2010

Turtle.Line

  • 2 types
  • 5 values
  • Packageturtle-1.6.2
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceLine.hs
newtypenewtype Line
#

A line of text (does not contain newlines).

Instances6Eq, Ord, Show, IsString, Semigroup, Monoid
  • Eq LineDefined in turtle-1.6.2 · Turtle.Line
  • Ord LineDefined in turtle-1.6.2 · Turtle.Line
  • Show LineDefined in turtle-1.6.2 · Turtle.Line
  • IsString LineDefined in turtle-1.6.2 · Turtle.Line
  • Semigroup LineDefined in turtle-1.6.2 · Turtle.Line
  • Monoid LineDefined in turtle-1.6.2 · Turtle.Line
valuetextToLine :: Text -> Maybe Line
#

Try to convert a text value into a line. Precondition (checked): the argument does not contain newlines.

valueunsafeTextToLine :: Text -> Line
#

Convert a text value into a line. Precondition (unchecked): the argument does not contain newlines.

datadata NewlineForbidden
#

The NewlineForbidden exception is thrown when you construct a Line using an overloaded string literal or by calling fromString explicitly and the supplied string contains newlines. This is a programming error to do so: if you aren't sure that the input string is newline-free, do not rely on the IsString Line instance.

When debugging, it might be useful to look for implicit invocations of fromString for Line:

>>> sh (do { line <- "Hello\nWorld"; echo line })
*** Exception: NewlineForbidden

In the above example, echo expects its argument to be a Line, thus line :: Line. Since we bind line in Shell, the string literal "Hello\nWorld" has type Shell Line. The IsString (Shell Line) instance delegates the construction of a Line to the IsString Line instance, where the exception is thrown.

To fix the problem, use textToLines:

>>> sh (do { line <- select (textToLines "Hello\nWorld"); echo line })
Hello
World
Instances2Show, Exception