[Haskell-cafe] Alternative to newtypes or orphan instances
sean.leather at gmail.com
Mon Aug 24 11:50:55 UTC 2015
On Mon, Aug 24, 2015 at 1:37 PM, Clinton Mead wrote:
> I see the problem now Sean. So in your example, is this correct:
> "To use the machinery of 'Show', I have to add and instance Show T. But
> that would be an orphan instance. So there is no way for T to use show
> machinery without adding an orphan instance (aside from modifying a module
> not under your control)?"
Even newtype doesn't seem to help in your example. Show has all this
> machinery, but it seems completely unusable without adding an orphan
> instance or re-writing other people's modules. Is there no other way? This
> situation seems incredibly against re-usability, which I thought was
> Haskell's strength. Am I missing something?
Orphan instances are one of unfortunate pain points of Haskell, though they
are sometimes a necessary “evil.” Erik's first response describes a common
technique for publishing and sharing orphan instances. See, for example,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe