[Hugs-users] Datatype (and Newtype) contexts: improvement

Anthony Clayden anthony.d.clayden at gmail.com
Thu Oct 15 00:29:19 UTC 2020


Thanks Sam, apologies if I'm being dumb, but I'm not seeing the relevance
of 'boilerplate'.

I'm not trying to implement other compilers' language extensions (as would
be clear from my occasional posts on the Hugs list). If you want GHC
extensions, use GHC.

There's no hope of writing stock H98 or even H2010 code. The last Hugs
release (2006, used in HugsMode) has extensions way beyond the H2010
standard. I'm not trying to write code that's portable between GHC/Hugs.

I'm tinkering with Hugs to give it semantics that GHC doesn't support/not
even with all its extensions switched on. I'm tinkering in Hugs because it
seems to be achievable whereas I just have no idea how to build GHC; and I
suspect that even if I figured that out, tinkering inside GHC would be
orders of magnitude more complex, because I'd keep running into all sorts
of type-acrobat stuff from all of GHC's extensions.

And I say "more complex" even though GHC is written in Haskell, and Hugs is
written in C++ and I'd never programmed in C++ before working on Hugs; and
even though C++ is imperative code, not functional. Hugs mostly uses
vanilla C, with the ++ providing sourcecode edit directives -- so it goes
some way towards the macro-generator of 'boilerplate' anyway.

Realistically for 'industrial strength' applications like Cabal, GHC is the
only game in town. Cabal should be conservative and not try to use
'bleeding edge' GHC extensions, but things like MultiParam TypeClasses,
FlexibleInstances are very hard to do without (Hugs supports both). What's
more, I don't see how a macro-generator like 'boilerplate' is going to
help. It's not like you can macro-'translate' code using MPTCs back to H98.

AntC

On Thu, 15 Oct 2020 at 02:48, Sam Halliday <sam.halliday at gmail.com> wrote:

>
> Sorry, I should have started a fresh email instead of responding to the
> mailing list.
>
> I just meant generally this might be of interest to you. The ability to
> generate the code that many language extensions are generating,
> therefore no need to add support in hugs. Making it easier for people to
> write portable stock Haskell98 code. Maybe even things like Cabal could
> be rewritten to use less extensions.
>
> Anthony Clayden wrote:
> > Hi Sam,
> >
> > I'm not seeing what relevance `boilerplate` has to anything I wrote.
> >
> > The compiler is generating the type for the constructors within a
> datatype
> > (whether or not the decl gives a context).
> >
> > On Wed, 14 Oct 2020 at 18:55, Sam Halliday <sam.halliday at gmail.com>
> wrote:
> >
> >>
> >> Hi Anthony,
> >>
> >> Did you see this?
> >>
> >>   http://hackage.haskell.org/package/boilerplate
> >>
> >>
> >>
>
> --
> Best regards,
> Sam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/hugs-users/attachments/20201015/7d3d8940/attachment.html>


More information about the Hugs-Users mailing list