Obscure instances for Obscure types

Hi I currently maintain two libraries, TagSoup which defines the Tag data type, and BinaryDefer, which defines the BinaryDefer class. If I wanted to include an instance for BinaryDefer Tag, where would I put it? Putting it in either library introduces an artificial dependency on the other. Putting it in a separate libary makes the library about 4 lines long and is just annoying. Putting it in the individual application(s) is exactly what libraries were designed to avoid. Is there a solution? Thanks Neil

I've had a similar question, which I think boiled down to a
compilation issue. Consider packages A and B that can be defined
independently. But, just as Neil pointed out, perhaps A and B could
also interact beyond their basic definition.
My naive idea is that A would compile the simple independent way if B
wasn't around and vice versa. But if A and B were both present at
compile time, then their interaction would also be compiled. The open
question is then where does that interaction live?
I would guess this problem has been solved in other systems. Anything
come to mind?
On 4/26/07, Neil Mitchell
Hi
I currently maintain two libraries, TagSoup which defines the Tag data type, and BinaryDefer, which defines the BinaryDefer class. If I wanted to include an instance for BinaryDefer Tag, where would I put it?
Putting it in either library introduces an artificial dependency on the other. Putting it in a separate libary makes the library about 4 lines long and is just annoying. Putting it in the individual application(s) is exactly what libraries were designed to avoid.
Is there a solution?
Thanks
Neil _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Taking a lesson from relational databases, I'd put it in 5-normal form: a separate module importing its two dependencies. Don't forget the 2nd law of thermodynamics: no 4-line file will stay 4 lines long after repeated code iterations. You might as well plan for the inevitable. If it's too annoying to wait for that inevitability, try commenting the hell out of it until it has a respectable number of lines. Dan Neil Mitchell wrote:
Hi
I currently maintain two libraries, TagSoup which defines the Tag data type, and BinaryDefer, which defines the BinaryDefer class. If I wanted to include an instance for BinaryDefer Tag, where would I put it?
Putting it in either library introduces an artificial dependency on the other. Putting it in a separate libary makes the library about 4 lines long and is just annoying. Putting it in the individual application(s) is exactly what libraries were designed to avoid.
Is there a solution?
Thanks
Neil _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hi Dan,
Don't forget the 2nd law of thermodynamics: no 4-line file will stay 4 lines long after repeated code iterations. You might as well plan for the inevitable.
If this library is for the extra interactions available when using a libary with 2 classes (thats all BinaryDefer is likely to ever have) and 1 data structure (thats all TagSoup is likely to ever have) I get 2 possible instances - and not a lot of scope for growth.
If it's too annoying to wait for that inevitability, try commenting the hell out of it until it has a respectable number of lines.
Comments are for people who can't sense what their code does from the indentation :-) That and Haddock doesn't let you comment instances in any way that shows up, so all my beautiful comments would be lost. Thanks Neil
Dan
Neil Mitchell wrote:
Hi
I currently maintain two libraries, TagSoup which defines the Tag data type, and BinaryDefer, which defines the BinaryDefer class. If I wanted to include an instance for BinaryDefer Tag, where would I put it?
Putting it in either library introduces an artificial dependency on the other. Putting it in a separate libary makes the library about 4 lines long and is just annoying. Putting it in the individual application(s) is exactly what libraries were designed to avoid.
Is there a solution?
Thanks
Neil _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Fri, 27 Apr 2007 00:40:33 +0100
"Neil Mitchell"
If it's too annoying to wait for that inevitability, try commenting the hell out of it until it has a respectable number of lines.
Comments are for people who can't sense what their code does from the indentation :-)
A bit of an exaggeration. I've written points-free code that *needs* comments in order for *me* to understand it six months later. ;)
That and Haddock doesn't let you comment instances in any way that shows up, so all my beautiful comments would be lost.
Yes, but you can still comment the module that contains them, which does show up, and manually list the instances. Since the number of instances is so small, this isn't hard. -- Robin
participants (4)
-
Dan Weston
-
Neil Mitchell
-
Nicolas Frisby
-
Robin Green