# Can Elm Repl process whole files, multiple modules, etc

**URL:** <https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259>\
**Category:** Learn\
**Created:** [March 21, 2022, 6:03am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259 "2022-03-21T06:03:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Mossey](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/michael_mossey/32/1995_2.png) [@Michael\_Mossey](https://discourse.elm-lang.org/u/Michael_Mossey)\
**Post date:** [March 21, 2022, 6:03am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/1 "2022-03-21T06:03:39Z")

</div>

I’m interested in warming up my Elm knowledge by completing a project that will process text files. It will have nothing to do with the web. I know that Node.js can do this, right? Does elm repl or is there some other integration with Node.js that would let me do this?

---

<div class="post-metadata">

**Author:** ![Carsten\_Konig](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/carsten_konig/32/4063_2.png) [@Carsten\_Konig](https://discourse.elm-lang.org/u/Carsten_Konig)\
**Post date:** [March 21, 2022, 8:47am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/2 "2022-03-21T08:47:49Z")

</div>

There is [elm/file](https://package.elm-lang.org/packages/elm/file/latest/) which you could use to get the content of a file and work with it.

Also I think there was some experiments in the community with running elm on node but IMHO this is not the intended use-case for Elm.

* * *

Every year there are some that do the Advent-of-Code puzzles with Elm which usually involves parsing a text-file but as far as I know most just paste the content of these puzzle-inputs as a string into a `.elm` file and work from there.

* * *

Personally I’d go to other languages/frameworks to work with files but I guess you could work it out.

(Not sure if this is ok for me to post it here - if not please let me know or remove it: If you want something like Elm and work directly on node you could try out PureScript - the basic syntax is very similar but the scope and type-system is somewhat _bigger_ compared to Elm. I personally resonate very much with PS and would recommend it.)

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [March 21, 2022, 8:56am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/3 "2022-03-21T08:56:31Z")

</div>

> [@Michael\_Mossey](#):
>
> I’m interested in warming up my Elm knowledge by completing a project that will process text files. It will have nothing to do with the web. I know that Node.js can do this, right?

Yes you can do it with Node.js. Here is an example you can use as a starting point:

[https://github.com/the-sett/elm-aws-codegen/blob/master/src/index.js](https://github.com/the-sett/elm-aws-codegen/blob/master/src/index.js)

---

<div class="post-metadata">

**Author:** ![Michael\_Mossey](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/michael_mossey/32/1995_2.png) [@Michael\_Mossey](https://discourse.elm-lang.org/u/Michael_Mossey)\
**Post date:** [March 21, 2022, 9:51am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/4 "2022-03-21T09:51:13Z")

</div>

elm/file looks perfect. I started learning Haskell 12 years ago and used it for a few personal projects. When I came up with this web project idea I started with Purescript but abandoned it eventually. Apparently my general web and javascript knowledge was not enough to understand how to use Purescript to make web pages beyond the simplest things and the Purescript documentation was not great at the time. Elm is more appealing to me with my given level of knowledge. I tutor computer science, normally Java and C++, but I did an Elm project with one of my students a couple years ago and we loved it.

---

<div class="post-metadata">

**Author:** ![Carsten\_Konig](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/carsten_konig/32/4063_2.png) [@Carsten\_Konig](https://discourse.elm-lang.org/u/Carsten_Konig)\
**Post date:** [March 21, 2022, 10:16am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/5 "2022-03-21T10:16:23Z")

</div>

Yes that’s true - for beginners Elm is a much better choice.

* * *

Well if you already know Haskell it’s probably no big deal but yeah it assumes more “common” javascript/node knowledge and while the docs are IMHO pretty good in PS what’s often hard to find are the entry-points into frameworks.

One problem is probably that there are various front-end libraries in PS which vastly different concepts - it’s hard to choose but there are really a few gems in there.

If you want to take another look: I’d recommend Halogen - it’s similar to TheElmArchitecture in style but fully embraces components (which makes the involved types a bit scary at first).  
Or if you already know some react then the react-bindings might be a good starting point also.

I really enjoy writing Elm but in some scenarios TEA and the way side-effects and FFI is handled is just a big source of boilerplate for me.  
This is where PureScript really shines for me - also it is way easier to link your own libraries (locally or in some git-repo) into a PS project.

---

<div class="post-metadata">

**Author:** ![mthiems](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/mthiems/32/2040_2.png) [@mthiems](https://discourse.elm-lang.org/u/mthiems)\
**Post date:** [March 21, 2022, 11:33am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/6 "2022-03-21T11:33:01Z")

</div>

We’ve had good luck with elm-posix:

> **[GitHub - albertdahlin/elm-posix: Write CLI-scripts in Elm](https://github.com/albertdahlin/elm-posix)**
>
> Write CLI-scripts in Elm. Contribute to albertdahlin/elm-posix development by creating an account on GitHub.

for processing files directly from the Linux command-line. However, for my team that was after already being very familiar with using Elm for conventional TEA / web development. I’m less sure that this would be a good way to build your Elm skills. But it is similar to what you were asking for.

---

<div class="post-metadata">

**Author:** ![wolfadex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/wolfadex/32/2461_2.png) [@wolfadex](https://discourse.elm-lang.org/u/wolfadex)\
**Post date:** [March 21, 2022, 11:41am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/7 "2022-03-21T11:41:31Z")

</div>

I’ve also been using elm-posix for Advent of Code, as you can see with my setup & solutions [advent\_of\_code/2021/lang-elm at main · wolfadex/advent\_of\_code · GitHub](https://github.com/wolfadex/advent_of_code/tree/main/2021/lang-elm).

If you’d prefer a repl like experience, you could use [REPL | Node.js v16.14.2 Documentation](https://nodejs.org/dist/latest-v16.x/docs/api/repl.html) along with Elm’s `Platform.worker`.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [March 31, 2022, 11:42am UTC](https://discourse.elm-lang.org/t/can-elm-repl-process-whole-files-multiple-modules-etc/8259/8 "2022-03-31T11:42:05Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
