
Indeed, avoiding expensive instances was part of the design
On Nov 18, 2013 5:21 PM, "Joachim Breitner"
Hi,
Am Montag, den 18.11.2013, 10:04 +0200 schrieb Sean Leather:
* Maintenance and development taken over by Sean Leather * Migrate repository from http://code.haskell.org/~dons/code/dlist/ to https://github.com/spl/dlist * Add `Eq`, `Ord`, `Read`, `Show`, `Alternative`, `Foldable`, `Traversable` instances
Given that the point of dlist is to speed up code where lists are insufficient, would it make sense to only provide those instances that can be implemented without converting to and from lists?
If there are instances that cannot be implemented idiomatically with dlists, maybe they should be left out, to signal the user that he will not get the benefits of DLists for these.
In particular, it seems that the Show instance could be improved. Currently it says showsPrec p dl = showParen (p > 10) $ showString "fromList " . shows (toList dl) i.e. goes via a list. But this is constructing a ShowS (which is String -> String) value, i.e. another difference list. Shouldn’t it be possible to stay in the world of difference lists when implementing this?
(Or maybe I’m overly worried, and I admit that I did not run benchmarks so far.)
Greetings, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries