On Thu, Jan 11, 2007 at 07:53:43PM +0100, Juliusz Chroboczek wrote:
> Simon,
> 
> Is there a way to request that ghc (6.6) flag all the uses of
> IO.bracket in Darcs?  There's a lot of places where we're using
> IO.bracket and should be using C.E.bracket, and I'd like to clean it
> up at some point.
> 
> Another thing I'd like to be able to do is to flag all uses of a given
> instance of a method in a type class.  The case in point is that we're
> using the instance
> 
>   show :: Control.Exception.Exception -> String
> 
> in quite a lot of places, and most of these are incorrect.
> 
> If there isn't, please consider this as a future request.

A feature request which I'll double! Particularly the method feature.  The
IO.bracket we could check in our test suite just by judicious parsing of
our source code to ensure we never import it.  Which requires a policy that
we never import all of IO, which I think would be a Good Thing anyhow.  But
I know of no practical way to ensure that the show instance of
Control.Exception.Exception is never used (and *that* would be a wonderful
thing to ensure!).

If we could somehow define a second instance of Show, or something like
that, and thus ensure a link error if either is used, that would be enough
(but I don't think that'd be possible, or the best approach).  Maybe a
language extension like "not instance Show Exception", which would allow
the removal of classes from a data type.  The trouble is that polymorphic
functions mean that without whole-program analysis you can't tell for
certain whether show is applied to an Exception unless you also ensure that
the Show instance of exception is also never used (which might cause
trouble if, for example, the MonadPlus or ErrorMonad class requires a show
instance, or something like that.  There could end up being some pretty
terrible spaghetti going on.  :(
-- 
David Roundy
Department of Physics
Oregon State University
_______________________________________________
darcs-devel mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-devel

Reply via email to