Elchemy

So someone made another elm-like language to compile to the EVM called Elmchemy. It is not really much like Elm in style, only in syntax, so it is just another ml-style language, I’ve not looked closely to it yet, thoughts?

5 Likes

Cool that it compiles to Elixir :003: hopefully it will get more Elm fans into Elixir as well :023:

For me personally I will stick to Elixir as I prefer its syntax.

1 Like

Yeah I’m not a fan of the haskell’isms in Elm’s syntax, very verbose.

Apparently it is written in Elm, to take elm code, and compile it to Elixir, consequently it runs in the browser too (see links on the github page) so you can type in elm and get elixir out in real-time, fully spec’d and all, though I’m not seeing any guards so that seems a little odd.

It is definitely not 'elm’y, what with the ‘ffi’ calls and all, those really should be a type definition of some sort, but they seem to be trying to keep compatibility with Elm’s syntax so you can compile it up with elm-make as well as elmchemy. It is an interesting method I must say, just not very Elm’y. ^.^

1 Like

It does not seem it is very strongly typed either, like this code:

type alias TestRecord =
  { int : int
  , float : float
  }

blah : TestRecord
blah =
  42

blorp =
  blah.x

Compiles to this Elixir

  @spec blah :: %{int: any, float: any}
  curry blah/0
  def blah() do
    42
  end

  curry blorp/0
  def blorp() do
    blah.x
  end

So… wtf? ^.^

It needs some work, a lot of work… It seems like it is mostly just a tokenizer and rewriter right now. ^.^

Also, let ... in ... do not seem to work yet?

At least I can say my MLElixir is fully type-safe. :smiley:

3 Likes

Hello Alchemists!

Creator here. Thanks for your notice. The web version doesn’t do typechecking since we can’t have haskell in the browser. Command line version does it properly using elm-make

Also I added let in today along with “as” in case branches!

We’re still far from 0.1.0 but I promise we’ll be done before June!

Stay tuned

7 Likes

Whooo Greets! :slight_smile:

If you want to do typechecking I’ve implemented a dozen or so HM type systems and can help answer any questions. :slight_smile:

Also whooo! It was hard to define values from expressions without it without making a ton of functions. ^.^

Looking forward!

1 Like

Just to update people interested in the project:

We’re out with version 0.3.0 - 99% of Elm’s syntax is covered and we also have semi-type-safe FFI to Elixir/Erlang based on @spec tags.
I’m gonna be following up with some tutorial articles pretty soon.

The next big leap will be elm-effects (Elm runtime) implemented on BEAM end, but if you’re just about creating a simple library that just has input and output (stateless) then Elmchemy is pretty much almost production ready

5 Likes

As always wanted to let you guys know that we’re out with a series of tutorials on Elmchemy

There is a part one on basics:
https://hackernoon.com/elmchemy-write-type-safe-elixir-code-with-elms-syntax-part-1-introduction-8968b76d721d

And part two on advanced stuff:

Part three (probably next month to be consistent) will be about Elixir interop. And I’m going to spoil something for you. The interop is type-safe based on @specs.
I must admit it is a little bit mind-blowing

We also hit 200 stars with a steady increase of about a 100 per month. Thank you guys!

Also for everyone attending ElixirConf in London this year I’m most likely gonna make a lightning talk about Elmchemy

9 Likes

And for note, Elchemy (it was renamed) can now self-compile. :slight_smile:

2 Likes

And for note, Elchemy (it was renamed) can now self-compile. :slight_smile:

I’m gonna say even more. Recent release reduced the time it needs to compile from 32 minutes to ~50 seconds.
That’s including around 50 files (11,000 lines) of dependecies.
And current work on elm-ast project will cut the time down even more :smiley:

All what is left for Elchemy is to self execute (Still needs Regex module in Std for that, plus couple of small tasks like handle function shadowing)
and obviously Elchemy-Effects

We’re starting to see the tip of version 1.0.0 milestone :tada:

12 Likes

Keep up the good work!

2 Likes

Wanted to give an update on the project!

We’re on version 6.6 right now. 500 stars on GitHub (THANK YOU ALL!) Since the last update the biggest feature is the incremental compilation

I’m gonna say even more. Recent release reduced the time it needs to compile from 32 minutes to ~50 seconds.

Now it’s 0.1 second :wink:

We’re really close to ship system for using macros (ExUnit, Plug, Ecto, Phoenix we’re coming to get you)

There’s a documentation on gitbook now with all of the ideas and features of Elchemy Table Of Contents · Elchemy

The effects system is still in development, but the project is definitely usable for business logic and it works pretty darn solid :muscle:

Everyone is always welcome to contribute, no matter if it’s code, articles, ideas or issues. Your input is always welcome!

8 Likes

Great stuff! Is it still under active development?

Just 5 hours ago I asked about it at the forum. When I saw the project at Github, I liked the idea at once. When I tried it online I liked the implementation too.

2 Likes

Glad you’re interested!

Yes, the project is still under active development. I did have to take a few months break due to personal reasons, but we’re back at full speed already. As a matter of fact the newest Elchemy-Live version is just about one week old

There is, however - as with every project like that - much more ideas than hands to implement them with.

Currently, on our Elchemy plate from the most burning issues we’ve got:

  • Elm 0.19 problems - New Elm version essentially made elm-github-install obsolete, which is our main package manager for Elchemy. Fortunately, our dependence on Elm’s ecosystem is actively shrinking.
    There’s an active project of reimplementing Elm’s type checking in Elm and essentially making Elchemy a fully fledged independent and self-hosted programming language (While still being a syntactical superset of Elm)
  • Side Effects - Side effects are still not implemented and the longer we think about the project the longer we consider experimentally implementing algebraic effects as a builtin and recommended way of dealing with side effects in Elchemy. It does, however, require our own type checker to be complete
  • Documenting new features - Even though the documentation is already quite decent there are still parts of Elchemy that are not documented. Testing and Elchemy.Macros are probably one of the most important
  • Elchemy-Env - A project of an universal and multiplatform one-click development environment based on Docker.
  • Elchemy-Live - Which allows better than anything for people to try Elchemy without getting all of the dependencies
  • Adding positional information to the parser to make compiling errors easier to read and debug

And from organizational stuff:

  • Moving to the new GitHub organization repo github.com/elchemy
  • Updating the articles on Medium, as well as writing some new ones to explain new functionalities

— Keep in mind this is all in my free time from a daily job —

There’s also been an idea to create a Patreon page for the project to give it a boost both in terms of funds and a motivation to go on. If there was any way for me to work on this project full time I would definitely do everything to be able to do it, but it is definitely a niche so it would be hard to find a sponsoring company for it.

I do optimistically believe that we can make Elchemy a very popular language and I also believe that Elixir proved that a boundary between a well designed but a different than everything language (Erlang) and a great active and interested community is user-friendliness.

If we won’t find funding, however, [we / I] will develop Elchemy further in as fast a pace as life will allow me to :wink:

PS. There is an application for a grant pending for $2,500 for Elchemy. It might be just enough to get better servers and maybe a Discourse hosted for us so that it’s easier to discuss stuff. It would also help us to get the word out since I’m pretty sure if we spend some more resources on marketing there would also appear some more people willing to help

5 Likes

A suggestion:
Why compile to Elixir? Why not implement a new language on BEAM with all of the strengths of Erlang and Elixir and with the syntax and type safety of Elm? It will grow slowly, but it will be a very solid thing.

(Of course it will be a lot of work, but all of the programmers who know Elm or even Haskell will come to this language, people who won’t come to a language which compiles to something those Elm programmers are not familiar with).

2 Likes