unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip McGrath <philip@philipmcgrath.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 55030@debbugs.gnu.org
Subject: [bug#55030] [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer.
Date: Sun, 1 May 2022 17:26:17 -0400	[thread overview]
Message-ID: <8bb2cf89-ae0e-cdcd-5149-a2d62aa3bbcc@philipmcgrath.com> (raw)
In-Reply-To: <87k0b52ec3.fsf@gnu.org>

Hi,

Hi,

On 5/1/22 16:22, Ludovic Courtès wrote:
> Hi Philip,
> 
> Philip McGrath <philip@philipmcgrath.com> skribis:
> 
>> This patch series updates Elm to version 0.9.1, then adds an
>> 'elm-build-system' and a 'guix import elm' command.
> 
> Impressive!
> 

Thanks!

>> To exercise the new features, this patch series then:
>>
>>    * Build the front-end for the `elm reactor` command (which is written in Elm)
>>      and adds a variant of Elm to Guix with the command enabled;
>>
>>    * Builds 'elm-todomvc', an official example of a basic Elm application; and
>>
>>    * Builds a feature-rich third-party package, "terezka/elm-charts":
>>      <https://elm-charts.org>.
> 
> Woow, neat.
> 
> Annoying question that I have to ask: do these packages bundle
> JavaScript libraries?  If yes, is it source or is it “minified”?
> 
> (My take is that we could tolerate some level of bundling if “doing the
> right thing” is impractical, but it’d rather be source.)
> 

Short answer: no, they don't!

Longer answer:

Elm basically takes the view that the existing JavaScript/NPM thicket 
should be considered harmful. It imposes a lot of very strict 
requirements on Elm "packages" (vs. "applications") to avoid whole 
classes of problems. Not all of them are precisely the requirements I 
would have chosen, but I like them better than the alternative chaos.

(One reason I gave this a try was to get some hands-on experience 
writing a build system and importer in a simplified context before 
trying to write `racket-build-system`.)

In particular, allowing arbitrary JavaScript would defeat the strong 
guarantees Elm wants to offer as a statically-typed, purely-functional 
language with compiler-enforced semantic versioning (well, for a 
decidable subset of "semantics") that can make runtime errors 
vanishingly rare in practice. To that end, Elm requires that 
"packages"---the things `elm-build-system` knows how to build---be 
written in pure Elm, with no JavaScript at all. For "applications", 
interop is limited to asynchronous message passing.[1] The only two 
"applications" in this series, the `elm reactor` frontend and 
`elm-todomvc`, don't use any message passing.

Of course, Elm needs some way to implement primitives. These are 
provided by modules in the `Elm.Kernel.*` namespace, which are written 
in JavaScript with the undocumented, unsafe conventions expected by the 
Elm compiler. The Elm compiler only allows kernel modules in packages in 
the `elm/*` and `elm-explorations/*` namespaces, so users can know that 
third-party packages won't break Elm's guaranteed, and the compiler is 
free to change its internal APIs without breaking anything. (This is 
free software, so you could patch the compiler to do whatever you want: 
it's just a community norm so strong it's expressed in code.) Even this 
is all source code with whitespace and comments: it's written in a very 
stylized way, as an ASM file in another compiler implementation might 
be, but it isn't generated code.

For people who want to "minify", Elm suggests flags for UglifyJS that 
can also do otherwise-unsafe whole-program optimization of the compiled 
"application".[2] (Compiling "packages" emits only an internal 
representation, not JavaScript.) In my own projects, I've also done 
other post-processing, like adding LibreJS comments and converting the 
output to an ES6 module. I haven't tried to make `elm-build-system` do 
any of those kinds of things for "applications": I think we should find 
more examples of Elm applications people would want to package for Guix 
first, rather than trying to guess what they might need.

[1]: https://guide.elm-lang.org/interop/
[2]: https://github.com/elm/compiler/blob/master/hints/optimize.md

-Philip




  parent reply	other threads:[~2022-05-01 21:27 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 23:27 [bug#55030] [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer Philip McGrath
2022-04-19 23:31 ` [bug#55030] [PATCH 01/30] gnu: elm-compiler: Update to 0.19.1 Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 02/30] gnu: elm: Rename package to match the command Philip McGrath
2022-05-01 20:22     ` [bug#55030] [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer Ludovic Courtès
2022-05-01 21:27       ` Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 03/30] guix: Add elm-build-system and 'guix import elm' Philip McGrath
2022-05-01 20:35     ` [bug#55030] [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer Ludovic Courtès
2022-05-01 22:03       ` Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 04/30] gnu: Add elm-core and elm-json Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 05/30] build-system/elm: Add implicit Elm inputs Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 06/30] gnu: Add elm-virtual-dom Philip McGrath
2022-05-01 20:37     ` [bug#55030] [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer Ludovic Courtès
2022-05-01 22:17       ` Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 07/30] gnu: Add elm-html Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 08/30] gnu: Add elm-svg Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 09/30] gnu: Add elm-time Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 10/30] gnu: Add elm-url Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 11/30] gnu: Add elm-browser Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 12/30] gnu: Add elm-bytes Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 13/30] gnu: Add elm-file Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 14/30] gnu: Add elm-http Philip McGrath
2022-04-19 23:31   ` [bug#55030] [PATCH 15/30] gnu: Add elm-parser Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 16/30] gnu: Add elm-project-metadata-utils Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 17/30] gnu: Add elm-explorations-markdown Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 18/30] gnu: elm: Support 'elm reactor' Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 19/30] gnu: Add elm-todomvc Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 20/30] gnu: Add elm-debois-elm-dom Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 21/30] gnu: Add elm-random Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 22/30] gnu: Add elm-explorations-test Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 23/30] gnu: Add elm-danhandrea-elm-date-format Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 24/30] gnu: Add elm-danhandrea-elm-time-extra Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 25/30] gnu: Add elm-justinmimbs-date Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 26/30] gnu: Add elm-justinmimbs-time-extra Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 27/30] gnu: Add elm-myrho-elm-round Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 28/30] gnu: Add elm-ryannhg-date-format Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 29/30] gnu: Add elm-terezka-intervals Philip McGrath
2022-04-19 23:32   ` [bug#55030] [PATCH 30/30] gnu: Add elm-terezka-elm-charts Philip McGrath
2022-05-01 20:22 ` [bug#55030] [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer Ludovic Courtès
2022-05-01 20:41   ` Ludovic Courtès
2022-05-01 22:22     ` Philip McGrath
2022-05-01 21:26   ` Philip McGrath [this message]
2022-05-08 21:34     ` Ludovic Courtès
2022-05-18 18:10 ` [bug#55030] [PATCH v2 00/34] " Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 01/34] gnu: elm-compiler: Update to 0.19.1 Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 02/34] gnu: elm: Rename package to match the command Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 03/34] guix: Add elm-build-system Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 04/34] gnu: Add elm-core and elm-json Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 05/34] build-system/elm: Add implicit Elm inputs Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 06/34] http-client: Accept '#:headers' in 'http-fetched/cached' Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 07/34] http-client: 'http-fetch/cached' converts strings to URIs Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 08/34] import: json: Accept '#:http-fetch' in 'json-fetch' Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 09/34] import: Add Elm importer Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 10/34] gnu: Add elm-virtual-dom Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 11/34] gnu: Add elm-html Philip McGrath
2022-05-18 18:10   ` [bug#55030] [PATCH v2 12/34] gnu: Add elm-svg Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 13/34] gnu: Add elm-time Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 14/34] gnu: Add elm-url Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 15/34] gnu: Add elm-browser Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 16/34] gnu: Add elm-bytes Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 17/34] gnu: Add elm-file Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 18/34] gnu: Add elm-http Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 19/34] gnu: Add elm-parser Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 20/34] gnu: Add elm-project-metadata-utils Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 21/34] gnu: Add elm-explorations-markdown Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 22/34] gnu: elm: Support 'elm reactor' Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 23/34] gnu: Add elm-todomvc Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 24/34] gnu: Add elm-debois-elm-dom Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 25/34] gnu: Add elm-random Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 26/34] gnu: Add elm-explorations-test Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 27/34] gnu: Add elm-danhandrea-elm-date-format Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 28/34] gnu: Add elm-danhandrea-elm-time-extra Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 29/34] gnu: Add elm-justinmimbs-date Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 30/34] gnu: Add elm-justinmimbs-time-extra Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 31/34] gnu: Add elm-myrho-elm-round Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 32/34] gnu: Add elm-ryannhg-date-format Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 33/34] gnu: Add elm-terezka-intervals Philip McGrath
2022-05-18 18:11   ` [bug#55030] [PATCH v2 34/34] gnu: Add elm-terezka-elm-charts Philip McGrath
2022-05-21 23:45   ` bug#55030: [PATCH 00/30] gnu: elm: Update to 0.19.1. Add build system & importer Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8bb2cf89-ae0e-cdcd-5149-a2d62aa3bbcc@philipmcgrath.com \
    --to=philip@philipmcgrath.com \
    --cc=55030@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).