Skip to content

Strictness and laziness ergonomics #317

Description

@Kleidukos

The fact that we have both lazy and strict Text types without any marker outside of their namespace is rather unfortunate.
In pretty big codebases or modules, it's also easy to forget that Data.Text.Lazy was imported.

This is why, inspired by Kowainik's work, I would like to introduce the following type alias:

import qualified Data.Text.Lazy as LT

-- | Type synonym for 'Data.Text.Lazy.Text'.
type LText = LT.Text

What it does

  • Allows the codebase contributor to specify with more clarity to other contributors that the Text flavour that is used is lazy, and reducing the cognitive overhead of said contributors. Very useful in codebase operated by multiple people over a long time with new onboardings.

What it does not

  • Provides a magic tool that solves every problem under the sun
  • Forces you to use it
  • Kills your kitten

A similar ticket was opened in the haskell/bytestring repo: haskell/bytestring#375

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions