Live data from Hacker News

Flix – A powerful effect-oriented programming language

flix.dev

111–120 of 197 posts

Re: Flix – A powerful effect-oriented programming language

#111
post #97

Any code agents work well with this or do we have to start thinking with our own brain again? Seriously though, looks like a cool language and makes me sad that LLMs will probably inhibit the adoption of new languages, and wonder what we can do about it.

I have the opposite gut feeling about LLM's; I think they're going to break down the barriers to adopting new programming languages, since they'll lower the cost of porting code dramatically. The code in a language's standard library is probably enough to train an LLM on the new syntax, and even if it isn't, agents now observe the compiler output and can in principle learn from it. Porting code from one language to a…

I hope so! On one hand I worry about the training corpus being so overwhelmingly biased toward certain languages that everything else will be drowned out. On the other, I think there'll be a point where we realize "reasoning" LLMs are more proficient with the same tools that we are: sound type systems, reusable libraries, concise syntax, DSLs where they make sense, etc. that the end game will look much more like skilled, experienced, thoughtful engineering work rather than the first of ten billion autocomplete attempts that happened to get something that met the basic requirements.

Re: Flix – A powerful effect-oriented programming language

#112

Earlier quoted context omitted.

It is a fair point-- the implicit argument being that this allows `c` and `d` to be bound before they are used, and hence auto-complete can assist in the `select` clause. Nevertheless, the counter argument is that the form of a logic rule is: Path(x, z) :- Path(x, y), Edge(y, z). i.e. an implication from right to left. This structure matches: query p select (x, z) from Path(x, y), Edge(y, z). So the trilemma is: A. K…

I appreciate the desire for consistency and being able to lean on old textbooks and documentation. A couple of considerations since this is a new language where history and precedent should (I think) be less important if it leads to clarity and improved productivity: 1. I think way more people coming to your language will be familiar with SQL and it's problems than with logic programming and Horn clauses. 2. I think…

All excellent points.

I think when it comes to programming language design, sometimes I feel that a design has a 90% chance of being good and a 10% chance of being bad. For the logic constraints (right-to-left vs. left-to-right), I think my confidence is only 70% that we got it right.

Re: Flix – A powerful effect-oriented programming language

#113
post #92

Earlier quoted context omitted.

In Flix all effects are tracked by the type and effect system. Hence programmers can know when a function is pure or impure. Moreover, pure functions can be implemented internally using mutation and imperative programming. For example, in Flix, one can express a sort function that is guaranteed to be pure when seen from the outside, but internally uses a quick sort (which sorts in place on an array). The type and eff…

Haskell can do the same kind of thing (local mutation), using the ST monad. It's usage is almost equivalent to using IORefs, except we can escape ST using runST to get back a pure value not in ST, which we cannot do for IO because there is no `IO a -> a`. There's no requirement to contain ST to a single function - we can split mutation over several functions, provided each one involved returns some `ST a` and their u…

That's right. Locally scoped mutable memory in Flix is very similar to the ST Monad. The two major differences are: (a) Flix is in direct-style vs. monadic style and (b) we use a type and effect system.

Note that there is no requirement that all mutation must occur within a single function. The requirement is that once you leave the lexical scope then all mutable memory associated with that scope become unreachable. Mutation can certainly span over multiple functions.

Re: Flix – A powerful effect-oriented programming language

#114
post #98

I am deeply impressed by the depth and breadth of this language. Algebraic data types, logic programming, mutability, all there from the get go. Another aspect that I love from their comparison table is that a single executable is both the package manager, LSP and the compiler. As I understand, the language server for Haskell has/had to do a lot of dances and re implement things from ghc as a dance between the partic…

The logic programming / datalog feels a bit gimmicky on top of everything else. All the other features, I can see exactly how they'd improve the type soundedness of a codebase. But logic programming is really niche and I'd almost rather it be independent of the language.

Right, it feels like a standard example of a Lispy library (Datalog), and a Prolog monad is standard teaching material. I am of the opinion that Flix is strictly worse than Idris2

Re: Flix – A powerful effect-oriented programming language

#115
post #31

I looked and Flix a while ago and found it really interesting - so much so that I wrote an article "Flix for Java Programmers" about it. Might actually be a bit outdated by now.. need to look at Flix's recent development again. But if you're interested: https://www.reactivesystems.eu/2022/06/24/flix-for-java-prog...

Cool blog post! With your permission, I would be happy to add it here: https://doc.flix.dev/blog-posts.html The language has improved a lot in the years since the post. In particular, the effect system has been significantly extended, Java interoperability is much improved, and some syntax have been updated.

Thanks! And of course you have my permission, I'd be honored if the post was included in that list.

Re: Flix – A powerful effect-oriented programming language

#116
post #83
post #31

I looked and Flix a while ago and found it really interesting - so much so that I wrote an article "Flix for Java Programmers" about it. Might actually be a bit outdated by now.. need to look at Flix's recent development again. But if you're interested: https://www.reactivesystems.eu/2022/06/24/flix-for-java-prog...

Wow what a gold mine your blog is. It’s like a more elaborate and well thought through version of thoughts that have been torturing me for years. Looking forward to reading it all.

Wow, thank you so much, that's flattering. And motivating - I shall start blogging again this month, and try to stick to a monthly cadence. Make sure to subscribe to the RSS feed or follow me on Bluesky or Mastodon, to get notified for new posts :)

Re: Flix – A powerful effect-oriented programming language

#117

I am deeply impressed by the depth and breadth of this language. Algebraic data types, logic programming, mutability, all there from the get go. Another aspect that I love from their comparison table is that a single executable is both the package manager, LSP and the compiler. As I understand, the language server for Haskell has/had to do a lot of dances and re implement things from ghc as a dance between the partic…

F# doesn’t have type classes (yet?) so programming with monads can be quite limited. It would be interesting if F# skipped Haskell style monads and jumped straight to algebraic effects. They seem like a better fit for F# philosophy in any case.

Right, they have something like computation expressions, but they are not composable.

For your second point, I don't know if they could achieve that without type level programming. This is the Box of Pandora the designer of F# tried [0] not to open.

____

0. https://github.com/fsharp/fslang-suggestions/issues/243#issu...

Re: Flix – A powerful effect-oriented programming language

#118

Earlier quoted context omitted.

As a non-functional-programming, c-language-familiar person, the syntax look fabulous. It seems like the first functional language I've seen that makes simple things look simple and clear.

It's kind of a bummer that "skins/themes" never caught on for programming languages. You see it once in awhile, I think some compiler people at one of the FAANGs did an OCaml skin/theme/alternative syntax (reason? something). And there's stuff like Elixir that's kind of a new language but also an interface to an existing world (very cool, Valim is a brilliant guy). But you could do it for almost anything. I would lov…

[deleted]

Re: Flix – A powerful effect-oriented programming language

#119
post #97

Any code agents work well with this or do we have to start thinking with our own brain again? Seriously though, looks like a cool language and makes me sad that LLMs will probably inhibit the adoption of new languages, and wonder what we can do about it.

I have good results from having a default prompt that instructs using Idris with indexed/dependent types ,(without that the bravest it gets is GADTs)

Re: Flix – A powerful effect-oriented programming language

#120

Earlier quoted context omitted.

Indeed. I even like the syntax.

As a non-functional-programming, c-language-familiar person, the syntax look fabulous. It seems like the first functional language I've seen that makes simple things look simple and clear.

It seems to have borrowed heavily from Rust, which got a lot of these details right.
Post reply on HN