mudasobwa

mudasobwa

Creator of Cure

Cure - a new language compiled to BEAM

I am happy to introduce the very α version of the new programming language compiled to BEAM.

Welcome Cure.

It has literally three killer-features:

  • Dependent types (think Idris) with SMT-solvers
  • FSMs with SMT-validation as a language primitive
  • No if-then-else construct.

I created Cure more as an ad-hoc DSL, rather than as a general purpose language. Currently it is in the proof of concept stage, although everyone might grab it, compile it, write and execute some code with it.

I am very open to suggestions, improvements, hints, and “this is all crap” comments.

Most Liked

AstonJ

AstonJ

Congratulations @mudasobwa :tada:

I’ve moved the thread here from libraries as it does not appear to be used within Elixir (if it is let me know and we can move it back).

Must admit I do not know much about FSMs and SMT verification myself (and I can’t be the only one) so it may be worth explaining in a bit more detail why those things are important enough to become a fundamental compelling part of your/a new language :icon_biggrin:

mudasobwa

mudasobwa

Creator of Cure

Not yet. Technically, this is not the first priority because effects make it drastically harder to use SMT solvers, and Cure is supposed to be used to implement critical parts of the logic and then call it from other BEAM langs.

My bad. I posted an announce too early because after a months deeply in, I was under the wrong impression that everything is evident and clean :slight_smile:

That’s definitely not the killer feature. Despite I have put some effort to optimization, Cure does not aim to be faster. It aims to be proved to be error-free.


Disclaimer. I got a COVID and I am off the grid until next week or so. Thanks everyone for understanding. I see there is an interest in what I am doing and therefore I’ll start with a proper timeline, and feature plan. Until now I was in a rush to make it work from Cure code through type checker, code gen and runtime, which is confusing for newcomers.

lpil

lpil

Creator of Gleam

I don’t think this is the case. From reading the documentation it seems that both have static type systems, but that’s where the similarities end. Gleam and Elixir have much more in common than Gleam and Cure do.

Compared to the stated features of Cure’s website Gleam offers very little in terms of static-analysis enforced correctness. If Cure’s static analysis functionality is a fighter jet then Gleam’s is a paper plane!

It will be interesting to see how the language develops. Both dependent types and SMT verification are active open areas of computer science research, and while useful and extremely powerful, how to make either of them approachable and productive in a language is an unsolved problem. Idris may be the most successful project there for dependant types, but even then it is a very challenging language to learn and write.

I couldn’t find any documentation on these features in Cure, and I wasn’t able to get any of the examples to compile and run, so I can’t say anything specific about their approach. I’m looking forward to seeing more as the language matures!

Dependant types are very slow to compile, however at runtime they can be used to produce significantly improved performance, as the compiler knows much more about the program. Unfortunately this benefit is likely not possible for Cure, as the BEAM doesn’t permit the programmer to disable runtime type checking. If it did Gleam could do that, making it substantially faster than Erlang or Elixir!

juhalehtonen

juhalehtonen

This seems very interesting! Ever since I first tried out Idris I’ve loved the idea of dependent types – and now you’re telling me I might use them on BEAM? Congrats on reaching this milestone :clap:

mudasobwa

mudasobwa

Creator of Cure

They don’t. Sending the mistyped message (:ook instead of :ok) to the arbitrary process won’t bring any harm whatsoever, but the application would be obviously misfunctional; assigning a negative value to the latitude won’t bring any harm, etc.

In Cure, if FSM has been compiled, it’s proven to be correct. The compiler won’t let you send a message to it which won’t be understood and handled.

I was simply tired to implement critical parts in Idris and then transate the code to Elixir once proved to be correct.

Just as an example: in Cure, List.reverse/1 is proven to be correct implementation. No tests are ever needed. That is also true for some user-defined functions.

Where Next?

Popular in Discussions Top

marcandre
Compilation time for our project degraded from ~26 seconds to ~32 seconds (~23% slower) :disappointed_face:. Did anyone else compare com...
New
smueller
With the announcement of 1.19 rc0 and the path to user-supplied type annotations, I want to make the case for inline types—both for funct...
New
AstonJ
@Garrison’s comment in another thread reminded me of this post by Joe: With the big five exerting more control than ever, new (AI) play...
New
arcanemachine
Just wondering what the community currently thinks, prefers, and/or recommends for working with UI components. (e.g. daisyUI, MishkaChele...
New
chulkilee
I’ve heard of several companies using Elixir + gRPC successfully. Tubi is one example - which sponsors grpc However, grpc still depends ...
New
dogweather
I realized I could really use something like this in my Phoenix project: I asked Claude 4 Sonnet if a port exists - it said no, and ga...
New
fireproofsocks
I’m not a Lambda fan-boy because I think it’s overprescribed as a cure-all for every possible problem when in reality, Lambdas are best s...
New
yordisprieto
I am trying to figure out a good architecture and implementation for authZ. Recently, I discover GitHub - open-policy-agent/opa: Open Po...
New
AstonJ
There seems to be a lot of buzz around DeepSeek at the moment, with some saying it’s a ChatGPT killer. The most remarkable thing (if they...
New
PragTob
:wave: I’m currently extracting the statistics calculation part from benchee and stumbled upon how to present error conditions. In the c...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement