Am Montag, den 18.11.2013, 10:04 +0200 schrieb Sean Leather:
> * Maintenance and development taken over by Sean LeatherGiven that the point of dlist is to speed up code where lists are
> * 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
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.)