Skip to content

stimes 0 is undefined on lazy text #632

Description

@kindaro

Consider this example:

λ import Data.Text.Lazy
λ stimes @Data.Text.Lazy.Text 0 (Data.Text.Lazy.pack "x")
"*** Exception: stimes: positive multiplier expected

Compare with the behaviour of stimes on String:

λ stimes @String 0 "x"
""

Surely we can return an empty lazy text!

This happens because implementation for stimes is not provided. A similar issue for strict text was addressed in #288.

There is also a blind spot in our test suite — it should reveal differences in behaviour between Text and String.

I drafted an implementation that resolves this issue, but there are certain fine points that we should address.

  • For strict text, stimes works only on relatively small numbers — specifically, Int. Should the same restriction apply for lazy text?
  • Should we expect any performance gains or losses? There is no bench mark measuring this yet.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions