[Haskell-cafe] [ANN] ttc-1.0.0.0 - Textual Type Classes
Henning Thielemann
lemming at henning-thielemann.de
Thu Jun 3 07:49:49 UTC 2021
On Thu, 3 Jun 2021, Travis Cardwell wrote:
> On Thu, Jun 3, 2021 at 2:57 PM Henning Thielemann wrote:
>> That is, your class is intended for text representation for program users
>> (instead of programmers)?
>
> Yes, that is correct. While Show instances should produce valid Haskell
> code and Read instances should parse that code to create the original
> value, forming an isomorphism, the Render and Parse type classes can be
> used by the developer to define instances as required for each
> particular application. The Render and Parse type classes in Data.TTC
> have no instances, allowing developers to write their own instances for
> Int for example, but some default instances can optionally be imported
> from Data.TTC.Instances when they are appropriate.
Are these instances orphan?
> The common way to get around the one-instance-per-type limitation is to
> use newtypes. I generally do not use this strategy with TTC to provide
> different ways to format text, however.
Is it feasible to have a newtype for any of "%3d", "%03d", "%05d" ...?
More information about the Haskell-Cafe
mailing list