chshersh/iris

[RFC] The 'Output' abstraction

chshersh opened this issue · 1 comments

From other issues, I noticed a pattern of having a data type displayed based on the terminal settings:

So I'm thinking about the best way to have an interface with the following requirements:

  • Users should be able to call a single function in the App monad that will automatically figure out how to print the value
  • Ideally, users shouldn't need to implement instances for their custom data types
  • It should be possible to write pure functions using this abstraction (for example, if users want to format their custom data type with colours but still be able to disable colours)

If you have any ideas, I'd love to hear 🙂

Adding an idea for the desired API.

Current usage: together with pretty-terminal

Iris.putStderrColouredLn
    (Pretty.style Pretty.Bold . Pretty.color Pretty.Green)
    "my message"

Desired usage: no external dependency besides iris

Iris.errLn $ Iris.bold $ Iris.green "my message"