-
Notifications
You must be signed in to change notification settings - Fork 11
Add --experimental-js-ts-exports flag for JavaScript/TypeScript interop #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: lamdera-next
Are you sure you want to change the base?
Conversation
Enables Elm modules to export functions for direct JS/TS consumption: - Generates ES6 module exports with curried/uncurried variants - Creates TypeScript declaration files alongside JS output - Filters internal wire protocol functions from exports
Regarding support for calling Elm functions without needing to perform currying, are you taking advantage of this existing implementation #41? |
Looking over this PR, it looks like it's going to cause a lot of merge conflicts down the line if changes are made to the Elm compiler? I know @supermario has put a lot of effort into keeping Lamdera features in separate modules whenever possible to minimize conflicts. Maybe he can weigh in on this. |
OK, so this question refers to an optimization that prevents the internals from using the curry mixer functions and the curried versions of function to be used, when an uncurried function would work. As far as I can tell both the curried and the uncurried versions of functions are available in the output code already (so I assume the uncurried versions are from #41 ) All this is doing is attaching a function on an export to each so
So if #41 works by default, I assume it will. |
Cool, I wasn't able to follow the code closely enough to tell but if you are using that then great |
I think our ability to refactor this code base is simply off the charts now with Claude 4. I don't speak Haskell and I was able to get property based tests up and an (admittedly amateurish) PR submitted. Claude was able to really comprehend what the intent was and work within the existing quality parameters. We can extend those tests and parameters significantly going forward. That said, I'm happy to use the same AI capabilities to attempt to do this without altering the existing modules, or altering them in a way that would be easy to merge later. I do believe it is unnecessary though. I think we really should embrace the fact that Elm has been effectively abandoned and that if Evan doesn't re-emerge almost right this moment as an active contributor, the effect of AI will render any contributions he makes less and less relevant the longer he takes to make them. Lamdera is the compiler now - if that makes us uncomfortable, it's only because of our respect for Evan, not because we or anyone are trying to take anything away from him. |
@supermario , I have a newer version of this which attempts to make it easier to merge with possible future elm versions. |
At a very quick look;
Otherwise so far so good, looking forward to reviewing and testing in detail soon. |
|
import { Main } from './output'; | ||
|
||
const greeting: string = Main.greet("John", "Doe"); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this was supposed to be committed?
@@ -0,0 +1,644 @@ | |||
{-# LANGUAGE OverloadedStrings #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be moved to extra/src/Lamdera/Typescript.hs
@@ -0,0 +1,3 @@ | |||
#!/bin/bash | |||
cd /home/schalk/git/compiler | |||
echo "Test.all" | timeout 600 stack ghci 2>&1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be removed
Hrm okay. So it's more How do you imagine this tool would get distributed to users? Have done a quick top level review, happy to go deeper once you've had a chance to work through feedback 👍 |
Enables Elm modules to export functions for direct JS/TS consumption: