8 ms·
Elchemy – write type safe Elixir using Elm-like syntax
- kenhwang 8y agoLooks like it's targeted more towards the Elm crowd with npm install instructions than the Elixir crowd with no hex/mix install method.
- iraasta 8y agoElchemy creator here. Quite the opposite to be honest. I come from Elixir background. It's just that npm is much more reliable when it comes to global system-wide installations
- lytedev 8y agoAre you saying Mix/Hex is unreliable or are you saying npm is on more machines globally?
- thdxr 8y agoHe's talking about installing a package globally on your system. That's the -g flag
- walterstucco 8y agoHex has global commands as well There's no real advantage in having a global command when the command doesn't make sense outside of a project folder
- the_duke 8y agoWhy would this target Elixir instead of Erlang or BEAM byte code directly? Putting a language on top of a language on top of a language does not seem that smart to me.
- ninjakeyboard 8y agoYeah I would expect to see it compile to bytecode. It seems pretty wild to transpile to a language to compile to bytecode to run in a vm when there is already bytecode and a vm to execute against. Transpiling is common in js only because there isn't/wasn't a standard like webasm.
- skolemtotem 8y agoSimilarly, despite the existence of LLVM and the simplicity of the various assemblies, tons of languages target C, mostly to facilitate easier interop with native libraries and because pretty much everything has a C compiler. Perhaps there were similar reasons to compile to Elixir, but I honestly can't think of any. It might just be for faster compiler development, at least until the featureset of Elchemy begins to significantly diverge from that of Elixir.
- eterps 8y agoFrom the FAQ: Do I need to have Elm installed to compile my .elm files with Elchemy? Elchemy uses Elm to typecheck your program. It is possible to use it without Elm on your machine, while it's not advised. So it seems that it literally transpiles Elm syntax to Elixir, the type safety relies on Elm apparently. Targetting BEAM directly should be possible in the future, to me it looks like an attempt to save a lot of time to make Elm suitable on the server side.
- wende 8y agoThis. There's no need to rebuild everything from scratch and fail due to too much to do. If the project grows more we can think about going low level. However, right now we can use everything that Erlang has, everything that Elixir has and most of what Elm has. It's a huge time and effort saver
- hderms 8y agoI mean if their goal is to get Elixir developers interested then I think that it satisfies.
- he0001 8y agoInception.
- moomin 8y agoOr if you’d rather have typeclasses: https://github.com/purerl/purescript https://github.com/purerl/purescript
- lf-non 8y agoPurescript by example[1] is the most approachable introduction to Functional programming that I have seen (yet). Even if you don't intend to ever use Purescript itself for application development, the book is worth a read, as an introduction to FP concepts, especially if you are coming from a Javascript/Web-dev background. [1] https://leanpub.com/purescript/read https://leanpub.com/purescript/read
- rlander 8y agoYou got me interested but the link barely worked on my iPhone...
- dmitriid 8y agoI largely agree, but it's not without its warts :) https://github.com/paf31/purescript-book/issues/99 https://github.com/paf31/purescript-book/issues/99
- moomin 8y agoIt’s also a bit out of date, but nobody’s perfect. :)
- ilovecaching 8y agoAs someone who writes Erlang for a living, I highly recommend rust as a well typed alternative to Erlang, that still keeps all of the things that make Erlang great. I do love Erlang, but working on a large codebase can be frustrating when nothing is speced or commented, and even when it is speced it’s usually part of a gradually typed codebase with very non descriptive types.
- RussianCow 8y agoCould you elaborate on why you find Rust to be an alternative to Erlang? For me at least, most of the draw of Erlang has nothing to do with the language, and everything to do with BEAM/OTP and the surrounding architecture, which (as far as I'm aware) Rust does not provide an alternative to in any shape or form.
- ilovecaching 8y agoSo Rust does not include built in abstractions/frameworks for building distributed systems, but I count that as a good thing. OTP can scale well under certain conditions. But it can also require rewriting supervision, servers, and other core pieces of OTP, which is a huge pain. BIFs can be slow or have wonky behavior, NIFs are dangerous but necessary when Erlang is too slow. When a language gives you prebuilt abstractions it can be a really good thing if they're the abstractions you need, and really bad if your requirements don't line up well, or you're coloring outside the lines in terms of scale or design. It can also be painful to introspect the BEAM to collect metrics and understand message queue pressure on a node. I'm so glad I get to work on Erlang rather than many of the other toolkits that are out there for building big distributed backend systems, but if I was going to start over again it were my choice I would choose Rust and build the right abstractions, the right protocols, and have total control over my system to make tailored performance trade-offs, and do it in a type safe environment, or I would use a third party distributed systems library like bifrost if my project was small. When I said all the things that make Erlang great, I mean pattern matching, FP, a focus on safety and reliability, and a really knowledgeable community. I'm kind of over BEAM/OTP at this point, but that's just my opinion, for the projects I'm working on.
- anthonybullard 8y agoLooks like your playground is based off Ellie, which is a great choice. However, it seems that there is an issue with downloading the Elm compiler. I'm getting a network failure from ellie's CDN(NAME_NOT_RESOLVED). Other than that, thank you for this, it is super interesting to me as I am a huge fan of both languages, and lack of type safety has always been my only misgiving with Elixir/Erlang. I'll have to take a spin this weekend.
- wende 8y agoSometimes the CDN is acting naughty That's true. The idea of how Ellie was brought to life is outstanding. Huge shoutout to Luke Wetsby for letting us use his codebase for Elchemy Feel free to share your thoughts and concerns on GitHub or by email! We'd love to hear your opinion and concerns
- lukewestby 8y ago<3 thanks fwiw the latest release moved the compiler back to the server. the ghcjs stuff proved too difficult to deliver a good experience to everyone. a naughty cdn was just one of many woes.
- rs86 8y agoWhat would be interesting is to have a subset with managed side effects and purity elixir i.e. something like Elm does at the frontend, the Elm experience is amazing and what annoys me in erlang is having too much effects around
- lf-non 8y agoLove the concept. But please don't use fonts with ligatures in code snippets on the homepage. Especially when these code examples are actually screenshots which people can't copy. Ligatures may be "obvious" to developers already familiar with the syntax of the language, but can make things very confusing for beginners, esp. in FP languages that lean heavily on operators etc. I am really glad that the docs/roadmap etc. are on Github. Github is really the gold standard when it comes to programmer friendly aesthetics.
- qop 8y agoMaybe this isn't targeting new users, then. His preferences supersede your sensibilities since its his website, don't you think?
- c3534l 8y agoMeh. You can reasonably expect someone interested in this project would have at least some passing understanding of functional programming, if not the niche of programming Elm and Elixir are trying to fill. In which case arrows and lambdas should be fine. Even if you're a C++ developer, you've seen arrows drawn in some capacity, I can't imagine what confusion using an arrow could possibly cause.
- Jarwain 8y agoThe confusion, which may not apply for a savvy developer, would arise from somehow believing that the unicode arrow (→) is being used and not the hyphen-greater-than-sign (->) arrow.
- undershirt 8y agoGreat name!
- matlin 8y agoThis is awesome and important work! I hope that this project can move independently of Elm's development once it gets enough interest though.
- wende 8y agoWe are hoping for that as well. Elm although making an amazing foundation might cause problems in future when introducing backwards incompatible changes for instance. We are trying to keep the safe distance from Elm development not to be too tightly coupled, but still making use of the awesome stuff Elm's team is doing
- didibus 8y agoSo I'm confused, is Elchemy its own language that compiles to Elixir? Or a way to add static types to existing Elixir code?
- wende 8y agoThe former. It is a language almost identical to Elm that compiles to a readable Elixir output. It has all of Elm's advantages - the type system, readable error outputs. On top of that, you can use all of Elm's tools like editor plugins or elm-format so there is no 'reinvent the wheel' syndrome
- methyl 8y agoElchemy looks fantastic, especially if you have some frontend in Elm already or you use it in Node microservices. The only thing concerns me that it won’t get enough traction and support and will eventally get abandoned, so here’s some Q’s. 1. What’s the genesis of this project? 2. Do you use it internally, is it backed by any company? 3. Is it already handling some production code? Thanks!
- wende 8y agoHi there, First of all, thank you for the post! It really made my day to see us land on HN I'm glad you like the idea. About the traction, I think I've got a mentality that makes it a little bit more bearable - even if it turns out nobody wants to use the project, I know I will so I'll always try to develop it and spend at least a weekend on it from time to time. Regarding the questions: 1. It's quite a long story which I'd be willing to tell one day, maybe at some conference. Basically, the idea started from 'typed elixir' which was a small POC project of mine. The Idea was to introduce type inference and annotations using only Elixir's macro system. It had a type inference algorithm I wrote in Prolog (to this day I'm still amazed how easy this language made it) and a bunch of hacky macros. However, after about half a year into development, I realized it's not a project that can be done singlehandedly and that there is simply too many compromises and hackishness to it. Half a year later on a LambdaDays 2016 conference in Kraków, Poland during a rather boring talk I've wrote a simple transpiler of Elm to Elixir as a joke just to find an entertainment. But the longer I developed the joke to more apparent it started to be it's actually something completely doable and with a great potential value. 2. Unfortunately no, not yet. It is being developed by me and sporadically by two other members of my company, but it's in no way supported by any big player. We'd love to get an interest like that though. If by any means some company representative is reading that and considering, please don't hesitate to mail me! 3. Depends on what we mean by production - is it running as a node of a huge Erlang system? - no, and probably won't be for some time. It's still a relatively young project with a lot of space to develop, it is slowly approaching maturity though and I think after we introduce an official way of handling side effects it's going to get much more traction. If the question is of "Is there anything big written already in Elchemy?" then kind off. I'm pretty sure that the biggest project written in Elchemy today is... Elchemy itself. Being self-hosted was very important to me and it is even a part of the CI pipeline right now. The moment of it being able to compile itself and execute in Elixir was a huge milestone in the development and a definite point in time when the project stopped to be just a Proof of Concept. We are currently working on a demo game written in Elm on the frontend and Elchemy on the backend. Its purpose is to demonstrate the maturity of the project, but also pinpoint some possible shortcomings that we might have missed. That's the main reason for starting the Elchemt DevBlog on Medium (https://medium.com/elchemy https://medium.com/elchemy) to share on the progress and possibly discuss different choices we still have to make As it's already becoming quite long-ish feel free to join our Gitter chat (https://gitter.im/elchemy-lang/Lobby https://gitter.im/elchemy-lang/Lobby) or to mail me! Cheers
- tills13 8y ago"Beautiful and fully readable output code" beautiful ... ? readable ... ? neither ... yes