r/functionalprogramming • • Feb 02 '21

Question What options are out there for cross-platform UI apps using functional languages?

33 Upvotes

This is some research that I do almost annually: I look for all the alternatives for building graphical apps (apps with an UI) using functional or functional-capable languages. My requirements are: cross-platform, the smaller app size the better, reasonably performant.

What I found so far are:

  • revery - ReasonMl

  • Avalonia.FuncUI - F#

  • Fabulous - F#

  • Any language that compiles to JS + wails (thin shell that uses golang)

    • I know some apps build using this combo and they are quite small (13 mb)

  • Any language that compiles to JS + electron (bloated, big, memory hungry)

  • Same as above + neutralinojs or DeskGap or Tauri

  • ReactNative (not very functional, but functional capable)

  • Kotlin (similar to ReactNative, functional capable)

Anything else to consider? Something that is not experimental or totally WIP?


r/functionalprogramming • • Oct 20 '20

FP Happy Cakeday, r/functionalprogramming! Today you're 8

33 Upvotes

r/functionalprogramming • • Mar 24 '20

Sihl: Full Stack Web Development in ReasonML

Thumbnail
medium.com
33 Upvotes

r/functionalprogramming • • 5d ago

Question What is your take on John Backus’s assertion that the FP (point-free) style is, in his view, more advantageous than the lambda calculus?

32 Upvotes

[Backus1981a] took up the lambda style (e.g., LISP [McCarthy1960] and Landin's ISWIM [Landin1964]): "In general, we suggest that the FP style offers a framework in which one can perceive and reason about program structures, truths, and transformations at a higher level of generality than that presently available for reasoning about lambda style programs." He acknowledged that using lambda abstraction one can define all of the FP program forming operations and "an infinity of others," but argued that this power would lead to undisciplined use and concluded: "Therefore perhaps it is time to begin designing a new generation of functional languages, languages that emphasize function level structure and function level reasoning."


r/functionalprogramming • • Jan 21 '26

FP Fidelity Framework is the best idea I've heard in a while

32 Upvotes

https://github.com/FidelityFramework

I am so impressed with the vision, and the clear engineering expertise being brought to bear here.

For those unaware, Houston is bringing fsharp to the bare metal, sacrificing nothing of the myriad ways that fsharp is absolutely fantastic, and making real innovations happen in his own custom compiler to take fsharp to low level, manual memory managed, native code. It takes an approach that, as far as I can tell, is superior to Rust's for managing lifetimes, but is INFERRED by default, and has the ability to be specific when you want some specialized allocation strategy.

This guy's the real mvp, and I think the fp community as a whole should get behind him, and help however we can.


r/functionalprogramming • • May 29 '25

OO and FP Why You Should Care About Functional Programming (Even in 2025)

Thumbnail
open.substack.com
32 Upvotes

r/functionalprogramming • • May 10 '25

Question What language to use??

32 Upvotes

I have very introductory experience with Haskell, like I know what are higher order functions, what immutability means and what is basically Lazy evaluation.

I want to make projects and challenges like AoC or codecrafters or codingchallenges.

What language shall I use? I have these options ?

Elm/Purescript Haskell Rust Gleam Roc lang (because it maybe more successful than Haskell)

And how can I learn more about Haskell, some book or something which explains the dreaded Monad in a simple way and have lots of exercises or a course ? Like SICP ?

Thanks 🤟


r/functionalprogramming • • Mar 24 '25

News Par, a lot of new stuff! Type system, language reference, interaction combinator runtime

32 Upvotes

Hello, everyone!

Two months ago, I posted here about a new programming language I was developing, called Par.

Check out the brand new README at: https://github.com/faiface/par-lang

It's an expressive, concurrent, and total* language with linear types and duality. It's an attempt to bring the expressive power of linear logic into practice.

Scroll below for more details on the language.

A lot has happened since!

I was fortunate to attract the attention of some highly talented and motivated contributors, who have helped me push this project further than I ever could've on my own.

Here's some things that happened in the meanwhile:

  • A type system, fully isomorphic to linear logic (with fix-points), recursive and co-recursive types, universally and existentially quantified generics. This one is by me.

  • A comprehensive language reference, put together by @FauxKiwi, an excellent read into all of the current features of Par.

  • An interaction combinator compiler and runtime, by @FranchuFranchu and @Noam Y. It's a performant way of doing highly parallel, and distributed computation, that just happens to fit this language perfectly. It's also used by the famous HVM and the Bend programming language. We're very close to merging it.

  • A new parser with good syntax error messages, by @Easyoakland.

There's still a lot to be done! Next time I'll be posting like this, I expect we'll also have:

  • Strings and numbers

  • Replicable types

  • Extensible Rust-controlled I/O

Join us on Discord!

For those who are lazy to click on the GitHub link:

✨ Features

🧩 Expressive

Duality gives two sides to every concept, leading to rich composability. Whichever angle you take to tackle a problem, there will likely be ways to express it. Par comes with these first-class, structural types:

(Dual types are on the same line.)

These orthogonal concepts combine to give rise to a rich world of types and semantics.

Some features that require special syntax in other languages fall naturally out of the basic building blocks above. For example, constructing a list using the generator syntax, like yield in Python, is possible by operating on the dual of a list:

dec reverse : [type T] [List<T>] List<T>

// We construct the reversed list by destructing its dual: `chan List<T>`.
def reverse = [type T] [list] chan yield {
  let yield: chan List<T> = list begin {
    .empty!       => yield,          // The list is empty, give back the generator handle.
    .item(x) rest => do {            // The list starts with an item `x`.
      let yield = rest loop          // Traverse into the rest of the list first.
      yield.item(x)                  // After that, produce `x` on the reversed list.
    } in yield                       // Finally, give back the generator handle.
  }
  yield.empty!                       // At the very end, signal the end of the list.
}

🔗 Concurrent

Automatically parallel execution. Everything that can run in parallel, runs in parallel. Thanks to its semantics based on linear logic, Par programs are easily executed in parallel. Sequential execution is only enforced by data dependencies.

Par even compiles to interaction combinators, which is the basis for the famous HVM, and the Bend programming language.

Structured concurrency with session types. Session types describe concurrent protocols, almost like finite-state machines, and make sure these are upheld in code. Par needs no special library for these. Linear types are session types, at least in their full version, which embraces duality.

This (session) type fully describes the behavior of a player of rock-paper-scissors:

type Player = iterative :game {
  .stop => !                         // Games are over.
  .play_round => iterative :round {  // Start a new round.
    .stop_round => self :game,       // End current round prematurely.
    .play_move => (Move) {           // Pick your next move.
      .win  => self :game,           // You won! The round is over.
      .lose => self :game,           // You lost! The round is over.
      .draw => self :round,          // It's a draw. The round goes on.
    }
  }
}

🛡️ Total*

No crashes. Runtime exceptions are not supported, except for running out of memory.

No deadlocks. Structured concurrency of Par makes deadlocks impossible.

(Almost) no infinite loops.* By default, recursion using begin/loop is checked for well-foundedness.

Iterative (corecursive) types are distinguished from recursive types, and enable constructing potentially unbounded objects, such as infinite sequences, with no danger of infinite loops, or a need to opt-out of totality.

// An iterative type. Constructed by `begin`/`loop`, and destructed step-by-step.
type Stream<T> = iterative {
  .close => !                         // Close this stream, and destroy its internal resources.
  .next => (T) self                   // Produce an item, then ask me what I want next.
}

// An infinite sequence of `.true!` values.
def forever_true: Stream<either { .true!, .false! }> = begin {
  .close => !                         // No resources to destroy, we just end.
  .next => (.true!) loop              // We produce a `.true!`, and repeat the protocol.
}

*There is an escape hatch. Some algorithms, especially divide-and-conquer, are difficult or impossible to implement using easy-to-check well-founded strategies. For those, unfounded begin turns this check off. Vast majority of code doesn't need to opt-out of totality checking, it naturaly fits its requirements. Those few parts that need to opt-out are clearly marked with unfounded. They are the only places that can potentially cause infinite loops.

📚 Theoretical background

Par is fully based on linear logic. It's an attempt to bring its expressive power into practice, by interpreting linear logic as session types.

In fact, the language itself is based on a little process language, called CP, from a paper called "Propositions as Sessions" by the famous Phil Wadler.

While programming in Par feels just like a programming language, even if an unusual one, its programs still correspond one-to-one with linear logic proofs.

📝 To Do

Par is a fresh project in early stages of development. While the foundations, including some apparently advanced features, are designed and implemented, some basic features are still missing.

Basic missing features:

  • Strings and numbers

  • Replicable data types (automatically copied and dropped)

  • External I/O implementation

There are also some advanced missing features:

  • Non-determinism

  • Traits / type classes


r/functionalprogramming • • Mar 04 '25

FP Replace Your ORM With Relational Algebra by Christoffer Ekeroth

Thumbnail
adabeat.com
32 Upvotes

r/functionalprogramming • • Mar 01 '25

FP 2nd functional language

32 Upvotes

I spent a good dead of time with Haskell in 2024; I built JSON Parser . I want to try something new. Or maybe strengthen at Haskell ? But I really don't like the Haskell tooling...

I want to try dynamic fp language. I have Elixir or Clojure has options, for some reason I am inclined to Clojure.

To be a better programmer, I want to learn about Concurrent And Parallel Programming, I guess all the 3 languages are good place to learn

Suggest me something. Also some resources to get started.

I also came across a book Grokking Simplicity, I ready first few pages and surprisingly it was funny and easy to read but that book uses Javascript (it's dynamic but isn't really functional 😞)


r/functionalprogramming • • Jul 17 '24

Question Learning FP - Currently at an impasse.

32 Upvotes

TL;DR: Some 4 months into studying FP through Haskell and feelling it's maybe the wrong tool to stick with after some point. What are you opinions in more moden FP tools like Elixir, Gleam?

Edit: Thanks for the responses guys, I really appreciate this community. What stuck with me is to devote more time into Haskell and try to understand it deeper before trying anything else, which is something that I pretty much expected. There are definitely many interesting tools out there, but, for now at least, I'll stick with understanding Haskell before jumping to more stuff. 🙏

Hello everyone. First of all I want to say that this subreddit has been more than helpful each time I've posted here - either sharing my journey through learning FP, or just asking questions. I've been programming for almost 10 years now, and this year I decided that I'm gonna give a serious shot to understanding Functional Programming. I don't know if I'm ever going to switch to writing exclusively FP and I don't care to be honest, I just know/feel that it definitely reserves attention.

I'm currenly at an impasse in my learning journey and thought it could be a good idea to post here, since I've often found quite knowledgable individuals lurking.

I've completed the Haskell Book within the span of 45 days. I've done every excercise. I've also written a JSON parser for practices as well as a basic web app using scotty. I've also briefly played postgres-simple and how to handle database connections, transactions and such.

After doing the above, I feel I'm at a point in which I need a challenging project in order to make use and really understand Haskell primitives and why they are important.

However, working with Haskell, despite its elegance, leaves me with a bad taste quite often. To add a disclaimer here, I'm a person that's more on the practical side of programming, rather than doing programming for the experience of programming. While I enjoy learning new thigs, I want to learn them in order to apply them. It's fine for me to learn a bunch of unapllicable stuff as well, but I do tend to filter them out as time progresses. I already work full time and I want to make use of my time outside work when studying in an efficient way.

As Chris Latner recently mentioned it feels like Haskell was not designed for modern computers, which is probably true. Also, following Simon Payton Jones, it seems Haskell was also not designed for production purposes. There are many many things you have to set aside in order to work and learn Haskell. In the recent years there have been amazing progress in the tool of popular/rising ecosystems, like Golang, Rust and I dare say JavaScript, that Haskell seems to lack thereof. I'm sure you can create anything with Haskell despite the difficutlies, but, when correlated with other tooling, it seems to underdeliver in terms of experience.

Having recently worked quite a bit with Go, I feel that it's probably the best imperative language we have right now, in terms of production value. It has an amazing tooling, it pretty simple, it has very solid multithreading primitives and it's really fast. I did some matrix multiplications in Haskell/Go/JavaScript and the results of Haskell were really really bad. I'm sure I missed quite a bunch of compiler optimizations but it seems that performance was never a priority for Haskell.

What I've come to believe is the problem with imperative languages though is that they tend to create enormous mudballs of code, regardless of the simplicity of the language. Imperative programming seems that it does not scale after some point. Declarative systems, even though inherintly more complex, they will eventually outscale imperative ones and perform better in maintainance and extensibility long-term. This is the area where FP seems to have production value to me.

What seems intersting in,which I haven't spent time yet, is the Erlang ecosystem. Erlang seems to be a product of a production need, rather than an academic one, and I expect that it's oriented towards solving problems rather than proving statements. Diving into erlang with Gleam or Elixir is something I would do if I have a problem that justifies the complexity of using BEAM.

I don't know how to continue from here on. I have doubts regarding Haskell and it beeing a solid choice for a modern development. I feel like modern tools designed for modern computers and today's developer needs tend to feel more natural that 20-30 year old projects/languages. When writing Haskell I feel more like I'm fighting the language rather than learning with it.

I want to get a better grasp of Functional Programming. Regardless if its Elixir, Ocaml, Gleam etc, when seeing those languages now I can already correlate ideas from Haskell, most of the time, which feels amazing. But I know deep in me that that's not enough. I want to really understand FP and come at a position when knowledge is transferable to any language, functional or not.

To sum up, my problems continuing with Haskell are:

  1. Clunky tooling regarding LSPs, debuggers, profiling

  2. Slow compile times

  3. Pretty bad performance when related to other languages

Personally, I feel that the above are part of the reason modern tools and languages get people excited quite often. They address long lived issues that are tough to deal with in environments that are 20-30+ years old. There's definitely merit in modern tools that people create.

Regardin this post as a whole, I would be curious about your opinion on this. Do you have any other languages/tools you'd advise me to look at, instead of Haskell? Or maybe you believe Haskell is definitely worth the "burden".

Do you have any projects that you did and helped you level up your understanding in FP?

Thanks for reading till the end!


r/functionalprogramming • • Apr 28 '24

Question Which Functional Language with strong typing to learn?

32 Upvotes

My background:

I'm a software engineer working a dayjob with Web development, using essentially just TS for everything

As a side project, I'm working on a game for which I'm using C#, GDScript and a markdown language we're creating called SPML

I've dabbled in some other languages, like C, C++, Rust, Ruby, Java, Python, and some others, but never really got deep into any Functional Programming language.

Recently I've started to learn about Clojure - I'm enjoying it, but I'm feeling the lack of types; coming from TS and Rust, which are my favorite languages so far, it feels so clunky to write anything without types. In Rust and TS I can hover over parameters and variables within functions and know immediately what they are; I hover over functions and I know exactly which type they return, what they take in, etc, and if I try to use something in an awkward way, the compiler lets me know immediately

What I'm looking for:

Essentially a popular strongly typed FP language, that can be as expressive as Clojure. I just want to learn it for myself, not really for looking into jobs, but popularity is important due to availability of packages and learning material. I really liked that on Clojure, but I'm not sure I'll continue learning it after finishing the current book due to the lack of typing

EDIT: Thanks for all the suggestions, everyone!

I'll probably stick to Clojure for a bit after hearing about Babashka; then I'll learn either F#, Haskell or OCaml


r/functionalprogramming • • Feb 07 '24

Haskell How I learned Haskell in just 15 years

Thumbnail duckrabbit.tech
32 Upvotes

r/functionalprogramming • • Jan 26 '23

FP Unison: A Friendly Programming Language from the Future • Runar Bjarnason

Thumbnail
youtu.be
32 Upvotes

r/functionalprogramming • • Nov 29 '22

FP Looking for a new language to learn for Advent of Code that's unlike anything you've tried before? Check out Unison!

Thumbnail
unison-lang.org
32 Upvotes

r/functionalprogramming • • Sep 13 '22

Jobs Job in FP compiler + quantum language implementation

32 Upvotes

Hey all, I hope this isn't off-topic here, but I wanted to give notice of a job opportunity at HRL Laboratories that deals with all sorts of programming language design and implementation issues, including a functional programming language called Coalton (see below). HRL Labs researches quantum computers based on a technology called "exchange-only silicon dot qubits". They're really cool, and easier than you might think to understand.

Technologically:

  • We primarily use Common Lisp. I think that's already interesting in its own right, but...

  • We implemented Coalton, an open-source strictly evaluated functional programming language with a Haskell-like type system. It is embedded in Lisp, and so it compiles to native machine code. We develop this as a part of our work.

  • We have some of the developers behind Quil, one of the top industrially used languages for quantum computing. It's one of the languages we use for quantum.

The team of which the position is a part has the overarching goal of using programming language design as a means to:

  • Make quantum computing easier for experimentalists

  • Make software more verifiable and debuggable

  • Make software that's efficient and outperforms other industry-standard techniques

Now, the job does have requirements that make a lot of interested applicants ineligible:

  • It's US citizen and US resident only, because of the need for security clearance eligibility

  • It requires relocation into the orbit of Malibu, Calif. (I'll admit, we do have a beautiful office.) You'd be working out real hardware, sometimes on secure networks.

With that said, we have a healthy company-wide WFH policy that is 50% time, but our team has more leniency and can accommodate more.

On the whole, we are just looking for really good, well-rounded software engineers who have a particular interest in working on different languages in this domain.

I'm happy to receive questions about any of the above here, even if it's just related to FP, quantum languages, Lisp, Coalton, Quil, or whatever.

Interested folks can also PM me, or just apply through the front door (linked above).

Thanks!


r/functionalprogramming • • Mar 09 '22

FP Debating if it's worth the effort to do logging in a "pure FP" way

32 Upvotes

Howdy. I've been posting regularly here and a few other subreddits as I push ahead with my studies of FP. I have really fallen in love with FP, and about 95% of the time I can't even imagine using an OOP, imperative, or side-effect-having approach anymore. However, this question is about one of the scenarios that falls in the other 5%.

NOTE: All code examples are in TypeScript using the fp-ts library, but the core of the question is language/library agnostic and I'm looking for guidance on general FP techniques.

LOGGING - THE COMPLICATED SIDE EFFECT

So based on the pure definition of a side effect, logging information to the console or a file 100% qualifies as such. This means that in a pure FP paradigm, all log statements need to be handled in an effectful way. At first glance, no big deal, we do this all the time for all sorts of parts of the application. However, the devil is always in the details.

My problem is I find that the level of effort required to do logging in a pure FP, safe/effectful manner feels like far more trouble than it is worth. I have gravitated towards FP because I feel there are genuine benefits in the quality of the code that I write, and I prefer practicality over theoretical purity. For logging, I feel that striving for theoretical purity is making my code more convoluted, harder to maintain, and more challenging to write and structure.

WHAT AM I DOING?

Currently I have approached logging through two main paradigms. I'm not thrilled with each. I will provide examples below.

IO-BASED LOGGING

This is the simplest one at first glance. I have written a logger where each logging method is wrapped in and returns an IO monad. This ensures deferred execution of the effectful computation:

const runCalculation = (data: Data): IO<string> =>
	pipe(
		logger.info('Running calculation'),
		IO.map(() => 'This is the calculation result')
	);

While this approach has a certain elegant simplicity to it, it also restricts where logging can be used. After all, IO is supposed to go towards the boundary of the application. While TypeScript & fp-ts do not enforce this (I can totally execute an io() function anywhere in my code), I don't like using that.

If I want to log some fine-grained details of my operation, I would have to wrap code farther down my functional chain in IO monads than I would otherwise prefer to do. While this can be worked around by breaking the code up into smaller, self-contained functions that are delegated to via IO.map(), thus maintaining purity for the broader codebase, it still feels excessive to use IO so deeply within the call stack.

WRITER-BASED LOGGING

The other alternative I know is using the Writer monad. Honestly, I like this one even less, as I feel it adds significantly more complexity to any solution that uses it. Writer allows for returning an array of strings that represent my log entries alongside the result of any computation.

const ArrayWriter = Writer.getChain(RArray.getMonoid<string>());

const runWithLog =
	(name: string): Writer<ReadonlyArray<string>, number> =>
	() =>
		[name.length, ['Got the length of the name']];

const execute = (): IO<number> => {
	const operation = pipe(
		runWithLog('Bob'),
		(writer) => ArrayWriter.map(writer, (length) => length * 2),
		(writer) => ArrayWriter.map(writer, (length) => length * 3)
	);
    const [value, logs] = operation();
    return pipe(
    	logs,
    	RArray.map(logger.info),
    	IO.sequenceArray,
    	IO.map(() => value)
    )
};

Because I can return that array, and easily concatenate values to it, in the end I get my result and log entries, at which point I can use my IO-monad logger to record them all at a higher level in the code.

This avoids using the IO monad deeply in the code, but instead requires using the Writer monad instead. Maybe it's the fp-ts implementation, maybe it's Writer in general, but it just feels even more convoluted to use this as well.

CONCLUSION

This just feels like so much effort simply to write to application logs. Since I'm primarily working in hybrid languages to begin with, I can get away with using more "traditional" loggers in my otherwise pure functions. However, before I give in to that, I'm hoping that there is additional guidance that can be provided.

Thanks.


r/functionalprogramming • • Feb 23 '22

FP "Early on, the biggest benefit was [FP] gave me a way of engaging with the flow of the data through my program in a manner that was a lot simpler." - Aaron Hsu

Thumbnail
youtu.be
32 Upvotes

r/functionalprogramming • • Dec 15 '21

Haskell Edward Kmett discussing his journey to using Functional Programming

Thumbnail
youtu.be
32 Upvotes

r/functionalprogramming • • Nov 14 '21

Journal of Functional Programming moving to Open Access

Thumbnail
cambridge.org
32 Upvotes

r/functionalprogramming • • Jun 30 '21

Question Clean Code / Domain-Driven Design-like books but with FP Examples?

32 Upvotes

I was looking at this list (https://github.com/mhadidg/software-architecture-books) and realized that almost all code examples in these books are OO. Are there sofware-architecture books which focus on design systems using FP languages?


r/functionalprogramming • • Dec 31 '20

Question Do monads prove that you can't explain *everything* in simple terms even if you understand it?

32 Upvotes

This is a serious question that makes me think about how we can be sure in general that we understand something. Is it just a feeling?

The quotes being referred to are:

"If you can't explain it in simple terms, you don't understand it" -Feynman

"If you can't explain it simply, you don't understand it" -Einstein


r/functionalprogramming • • Jun 24 '20

Haskell Haskell for a New Decade [pdf]

Thumbnail dev.stephendiehl.com
32 Upvotes

r/functionalprogramming • • Jun 28 '19

FP Average salaries, favourite languages and more: A look at the state of Functional Programming

Thumbnail
functional.works-hub.com
32 Upvotes