Documentation

Hale.Base.Data.String

Overloaded string literals. A type α with an IsString instance can be constructed from a String literal.

$$\text{fromString} : \text{String} \to \alpha$$

  • fromString : Stringα

    Convert a String to the target type.

Instances

    Split a string into lines (on '\n').

    $$\text{lines}(\text{"a\\nb\\nc"}) = [\text{"a"}, \text{"b"}, \text{"c"}]$$

    Equations
    Instances For

      Split a string into words (on whitespace).

      $$\text{words}(\text{"hello world"}) = [\text{"hello"}, \text{"world"}]$$

      Equations
      Instances For
        def Data.DataString.words.go (acc rest : List Char) (result : List String) :
        Equations
        Instances For

          Join lines with '\n'.

          $$\text{unlines}([\text{"a"}, \text{"b"}]) = \text{"a\\nb\\n"}$$

          Equations
          Instances For

            Join words with ' '.

            $$\text{unwords}([\text{"hello"}, \text{"world"}]) = \text{"hello world"}$$

            Equations
            Instances For

              unwords of empty list is empty.