Show instance for SrcSpan

Alan & Kim Zimmerman alan.zimm at gmail.com
Mon Oct 6 13:48:08 UTC 2014


To get even more heretical, a quick grep of the compiler source tree does
not show

    SrcSpanOneLine / SrcSpanMultiLine / SrcSpanPoint

being used anywhere but in SrcLoc.lhs.

The use in SrcLoc is in the original constructor, the deconstructors
pulling out lines and columns, and combineSrcSpans.

Perhaprs our SrcSpan is more complicated than it needs to be?

On Mon, Oct 6, 2014 at 3:37 PM, Matthias Fischmann <mf at zerobuzz.net> wrote:

>
> Ah, you want to drop constructor field names.  Then I withdraw my
> reservations.
>
> thanks for the clarification,
> m.
>
>
>
> On Mon, Oct 06, 2014 at 03:27:49PM +0200, Alan & Kim Zimmerman wrote:
> > Date: Mon, 6 Oct 2014 15:27:49 +0200
> > From: Alan & Kim Zimmerman <alan.zimm at gmail.com>
> > To: Matthias Fischmann <mf at zerobuzz.net>
> > Cc: "ghc-devs at haskell.org" <ghc-devs at haskell.org>
> > Subject: Re: Show instance for SrcSpan
> >
> > Not at all, just show as e.g.
> >
> >   SrcSpan (RealSrcSpan (SrcSpanOneLine "./foo.hs" 4 1 6))
> >
> > We just avoid showing the srcSpanFile / srcSpanLine / srcSpanSCol /
> > srcSpanECol noise
> >
> >
> > On Mon, Oct 6, 2014 at 3:16 PM, Matthias Fischmann <mf at zerobuzz.net>
> wrote:
> >
> > > On Mon, Oct 06, 2014 at 02:59:03PM +0200, Alan & Kim Zimmerman wrote:
> > > > Date: Mon, 6 Oct 2014 14:59:03 +0200
> > > > From: Alan & Kim Zimmerman <alan.zimm at gmail.com>
> > > > To: "ghc-devs at haskell.org" <ghc-devs at haskell.org>
> > > > Subject: Show instance for SrcSpan
> > > >
> > > > Is there any reason I can't put in a diff request to replace the
> derived
> > > > Show instance for SrcSpan with a handcrafted one that does not
> > > exhausively
> > > > list the constructors, making it more readable?
> > > >
> > > > Alan
> > >
> > >
> > > I like the notion that `Read . Show` should always work.  Dropping
> > > parts of a datatype would break that rule.
> > >
> > > matthias
> > > _______________________________________________
> > > ghc-devs mailing list
> > > ghc-devs at haskell.org
> > > http://www.haskell.org/mailman/listinfo/ghc-devs
> > >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20141006/c9a4ac85/attachment-0001.html>


More information about the ghc-devs mailing list