# How to contribute to native modules in elm package

**URL:** <https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802>\
**Category:** Learn\
**Created:** [June 17, 2019, 5:10am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802 "2019-06-17T05:10:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![misoton665](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/misoton665/32/1667_2.png) [@misoton665](https://discourse.elm-lang.org/u/misoton665)\
**Post date:** [June 17, 2019, 5:10am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/1 "2019-06-17T05:10:43Z")

</div>

In ver 0.19, native modules are not allowed except in `elm/` or `elm-explorer/`.  
I found a chance to contribute to native modules in elm package. However, because of this restriction, I can’t debug with native modules and contribute to this package.

Is there a special way to do this? Or, I’m not allowed this contributing?

---

<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:** [June 17, 2019, 10:28am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/2 "2019-06-17T10:28:21Z")

</div>

Which package is it? You can make pull requests against the packages under elm/ and elm-explorations/ on GitHub same as anything else on there. It also seems that the best way to have success with this is to approach the project maintainer and talk your proposed changes through with them - Evan in most cases, but some of these projects do have other maintainers.

Testing the changes is not so easy with the native restrictions.

---

<div class="post-metadata">

**Author:** ![avh4](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/avh4/32/97_2.png) [@avh4](https://discourse.elm-lang.org/u/avh4)\
**Post date:** [June 17, 2019, 10:08pm UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/3 "2019-06-17T22:08:12Z")

</div>

I haven’t had to do this in a while, but I think this approach still works for testing out changes to a package with native code:

- in your terminal, set `ELM_HOME` to some new directory (this will make the stuff that’s normally put into `~/.elm` be put in the specified folder instead)
- then you can make the changes you want to test in `$ELM_HOME/0.19.0/package/[package name you are modifying]/[latest package version]/src`
- then if you compile your test app or tests with `ELM_HOME` set, it will use your changed version of the package

---

<div class="post-metadata">

**Author:** ![misoton665](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/misoton665/32/1667_2.png) [@misoton665](https://discourse.elm-lang.org/u/misoton665)\
**Post date:** [June 18, 2019, 3:44am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/4 "2019-06-18T03:44:26Z")

</div>

I’m thinking about elm/bytes.

I know that talking with a project maintainer is needed to contribute to an Elm package.  
So, I will try to describe my approach!

I’m relieved to hear that allowed to make pull request.

---

<div class="post-metadata">

**Author:** ![misoton665](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/misoton665/32/1667_2.png) [@misoton665](https://discourse.elm-lang.org/u/misoton665)\
**Post date:** [June 18, 2019, 3:58am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/5 "2019-06-18T03:58:18Z")

</div>

I didn’t know `ELM_HOME`.

This way is available in my environment too.  
I will try to test my code in this way. Thank you!

---

<div class="post-metadata">

**Author:** ![antew](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/antew/32/2102_2.png) [@antew](https://discourse.elm-lang.org/u/antew)\
**Post date:** [June 18, 2019, 1:42pm UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/6 "2019-06-18T13:42:50Z")

</div>

In a similar vein, you can symlink in a directory to `~/.elm/0.19.0/<package>/<version>/`.

I think you also have to delete the `.dat` files generated in that directory after each build and remove the elm-stuff directory in your project to see the changes show up.

---

<div class="post-metadata">

**Author:** ![jerith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/jerith/32/114_2.png) [@jerith](https://discourse.elm-lang.org/u/jerith)\
**Post date:** [June 20, 2019, 2:31am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/7 "2019-06-20T02:31:10Z")

</div>

You might find some insight in the [test script for `elm/core`](https://github.com/elm/core/blob/master/tests/run-tests.sh). Although that might be overkill for other `elm/*` packages which aren’t treated specially by the compiler.

---

<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:** [June 30, 2019, 2:31am UTC](https://discourse.elm-lang.org/t/how-to-contribute-to-native-modules-in-elm-package/3802/8 "2019-06-30T02:31:11Z")

</div>

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