Future of "Text.Show.Functions" module
Edward Kmett
ekmett at gmail.com
Sun Oct 19 21:24:25 UTC 2014
Malcolm's reasoning matches mine perfectly here.
The instance should not be standard.
It should never go into Prelude.
It standardizes on one of many viable choices.
However, it is one of those things that folks, rightly or wrongly, define fairly often and removing it would increase conflicts among orphans doing the same thing.
I'd strongly advocate holding your nose and leaving it there.
Sent from my iPhone
> On Oct 19, 2014, at 9:55 AM, Malcolm Wallace <malcolm.wallace at me.com> wrote:
>
>
>> On 19 Oct 2014, at 11:20, Herbert Valerio Riedel wrote:
>>
>> -- This module deliberately declares orphan instances:
>> {-# OPTIONS_GHC -fno-warn-orphans #-}
>>
>> -- | Optional instance of 'Text.Show.Show' for functions:
>> --
>> -- > instance Show (a -> b) where
>> -- > showsPrec _ _ = showString \"\<function\>\"
>> --
>> -----------------------------------------------------------------------------
>> Should this module be
>> deprecated, removed, alternatively, should the `Show` instance be made a
>> non-orphan (e.g. by importing it by the `Prelude` module), or shall this
>> curiousity be just left untouched in `base` in its current form?
>
>
> Under no circumstances should this instance ever be visible from the Prelude.
>
> It was deliberately made an orphan because the instance is non-conformant to the intended semantics of the Show class. Having a default instance of Show for functions would be a disaster, by causing static type error messages that indicate an arity problem, to become erratic runtime behaviours instead (without even throwing an exception).
>
> Nevertheless, it was found many years ago that lots of people defined this instance as a convenience, or a debugging aid. And once it accidentally gets into two different released libraries, the orphans conflict, and the libraries become unusable together. This is why a single "standard" orphan was thought preferable to multiple conflicting orphans.
>
> In summary, if you want this instance, you should know that it is problematic, and that you need to import it explicitly.
>
> Regards,
> Malcolm
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
More information about the Libraries
mailing list