Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] The 'Output' abstraction #110

Open
chshersh opened this issue Mar 1, 2023 · 1 comment
Open

[RFC] The 'Output' abstraction #110

chshersh opened this issue Mar 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@chshersh
Copy link
Owner

chshersh commented Mar 1, 2023

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 🙂

@chshersh
Copy link
Owner Author

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant