Is there a functional language which compiles to JS and allows usage of JS libraries?


#1

Hello everyone,
Is there a functional language which compiles to JS and allows usage of JS libraries?

Here are some of my points:

  1. TypeScript is based on an amazing concept of being a superset of JS, which means that any valid JS code is also valid TS code, allowing usage of existing JS libraries.Now, TS is great, but I need a functional language which compiles to JS, and for which I do not have to sacrifice the JS libraries I already use.
  2. I use Elm to create web apps; let’s say I want to use Phaser and Box2D with Elm, I can’t do much except for passing on data back and forth.
  3. I thought about compiling Elm, or any other functional language like ClojureScript, PureScript, ElixirScript, to JS and merging it with my JS codebase, but that’s just painful. I am limited to only referring to the generated JS code from my hand-coded JS, but not the other way around.

Thank you! https://sarkariresult.onl/ Mobdro


#2

Isn’t this a limitation of Elm?

elm-make has a limited support for working with JavaScript and CSS.

Hype is all about JavaScript, CSS and HTML5. Additionally, Hype uses matter.js as a Physics engine. I suppose you could add Box2D to Hype, but then you’d be working without the inherent advantages of Hype.

Sure, you could edit your Hype files in something like Visual Studio Code, but I’m not sure how that would work with TypeScript or SASS. Even if it does, wouldn’t maintaining that bridge might be too much trouble? I’m not even sure if it works at all, as I don’t use TypeScript and I don’t like SASS. Getting your changes back into Hype could be a lot of extra work.

Hype seems best for people that don’t want to code. It has the option to add code as needed, but I’m not sure it’s the right tool to keep up with the spaghetti mess that is today’s modern web development…

What is it you’re trying to do? Are you trying to make games and turn them into apps? If so, that is possible with Hype. It’s not so easy or intuitive though. If you’re working with Phaser, and you’re looking for an IDE, wouldn’t Phaser Editor be more suited? https://phasereditor2d.com/

I haven’t used Phaser much. I’m not familiar with Elm, TypeScript, the Phaser Editor or even SASS… and I just woke up. Ha ha, so that’s the best info I have regarding this topic.