[Haskell-cafe] [ANN] ttc-1.0.0.0 - Textual Type Classes

Henning Thielemann lemming at henning-thielemann.de
Thu Jun 3 09:18:20 UTC 2021


On Thu, 3 Jun 2021, Travis Cardwell wrote:

> On Thu, Jun 3, 2021 at 4:49 PM Henning Thielemann wrote:
>> On Thu, 3 Jun 2021, Travis Cardwell wrote:
>>> 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?
>
> Indeed they are.  I use the following directive to hide the warnings for
> that module:
>
>    {-# OPTIONS_GHC -fno-warn-orphans #-}

I would not do that. Even orphan instances must be unique. If I would 
decide to define my own instances but import a library that transitively 
imports Data.TTC.Instances somewhere, I get a clash. Orphan instances are 
really only helpful for the case where you need an instance but you 
neither maintain the class nor the type definition but otherwise are sure 
that your instance is the one and only.


More information about the Haskell-Cafe mailing list