Why Functional Programming Should Be the Future of Software

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • book

    The Rust Programming Language

  • > it is heavily influenced by FP

    Is it really? I agree with the rest of your post, that Rust provides great tooling, but not sure it's "heavily influenced by FP", at least that's not obvious even though I've been mainly writing Rust for the last year or so (together with Clojure).

    I mean, go through the "book" again (https://doc.rust-lang.org/book/) and tell me those samples would give you the idea that Rust is a functional language. Even the first "real" example have you mutating a String. Referential transparency would be one of the main point of functional programming in my opinion, and Rust lacks that in most places.

  • peds

    Type safe persistent/immutable data structures for Go

  • Or lets look at persistent data structures, a staple of functional programming:

    https://github.com/tobgu/peds

    Notice how you'd need to generate the DS for every type you'd like to use it, which is not the case with built in mutable maps and slices.

    To make them type-safe, you need to generate them for every type you use. While this is technically possible, it does make the language quite hostile towards functional programming. With generics, this is rectified but the problem with non-composable multi-return-value functions still remains

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • fun-problems

  • great for reading trees, but not for cases where nodes need to be added or removed. There's a "zipper tree" structure but it's kind of a pain to implement:

    https://github.com/xdavidliu/fun-problems/blob/main/zipper-t...

  • dotnet-script

    Run C# scripts from the .NET CLI.

  • I do agree.

    I think .Net has got it right. And dotnet-script [https://github.com/dotnet-script/dotnet-script] has been a game-changer for me with a REPL-like experience for unit testing and writing command-line utilities.

  • cl-autowrap

    (c-include "file.h") => complete FFI wrapper

  • Common lisp has a "pretty OK" story for calling C code whenever some speed is needed [0,1]. In my opinion, they suffer from some of the documentation/quick start problems that common lisp has, but they're otherwise usable.

    Some of Naughty Dog's late 90's/early 2000's games (Jak and Daxter, Jak II) were written in a lisp called GOAL, Game Oriented Assembly Lisp [2]

    [0] https://github.com/rpav/cl-autowrap

  • cffi

    The Common Foreign Function Interface

  • Halide

    a language for fast, portable data-parallel computation

  • I like and agree with much of the advantages of FP, but I’ve never used it exclusively.

    A number of years ago, we worked with a startup that was based around a new FP language, focused on image processing pipelines[0]. It’s actually vey cool. We came from a C++ background.

    Learning the language was difficult, but our team was very capable, and very experienced. We did it.

    But it was just too limited, and the advantages never appeared for us. We were doing it for an embedded implementation.

    It was a really neat experience, but ended up as a failure. I am sorry for that, as I actually thought they had the right idea, and I think that management failure was as much to blame as technical hurdles. The language had many limitations, but we were still able to work with it. That’s what you get, with a highly capable team.

    These days, I program in Swift, which has many FP features. I enjoy it.

    Nonetheless, I think that many of these “new paradigms” are built around the premise that most programmers suck, and need to be forced to write good code, and that never seems to work.

    Companies seem to be desperate to hire crappy engineers, and get them to write good code, as opposed to hiring decent engineers, in the first place, and those folks can write good code, regardless of the tools.

    [0] https://halide-lang.org/

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • turtle-geometry

    Command turtle graphics using Scheme dialect on your Android

  • > Really, anything from the book Turtle Geometry would have a challenging time in a lot of functional languages.

    https://github.com/sergv/turtle-geometry

    Is an implementation of the book Turtle Geometry in Scheme. A Lisp dialect.

    > Which is not that most functional languages are bad. Just they don't usually even try to abstract over the graphical. I hate that folks see how well the abstract over functions and assume that is all programming is.

    There is an entire section of SICP dedicated to graphical abstraction using functions and function composition.

  • dhall

    Maintainable configuration files

  • ```

    If you mean installing Dhall's dependencies (https://github.com/dhall-lang/dhall-haskell/blob/master/dhal...), those aren't too crazy, but they're definitely not all "beginner level". Template Haskell in particular is quite heavyweight.

  • milewski-ctfp-pdf

    Bartosz Milewski's 'Category Theory for Programmers' unofficial PDF and LaTeX source

  • That seems a little silly to me and I think we're splitting hairs with what it means to do category/set theory. I don't know category or set theory, so I hope you will forgive me for using yet another allegory.

    Let's say I make a type class for Groups (in the abstract algebra sense). The rationale behind this is that there's an algorithm for exponentiation which is O(log(n)) versus the naive O(n) algorithm. So if you make an instance that's a Group, you get to use this fast exponentiation.

    Sure, to understand and use this type class you have to understand what a Group is. However, I think it's a bit of a stretch to tell someone "in order to use Group you must first learn abstract algebra" because they'll think you're telling them to take a university level course. In actuality, they don't have to know much at all (they don't even need to understand _why_ the exponentiation algorithm works) - they just need to know what is a lawful Group.

    Like this is my understanding of Functors/Applicatives/Monads. I kind of know their shape and how to use them. If you asked me about any of the underlying math I would shrug and maybe draw a pig (https://bartoszmilewski.com/2014/10/28/category-theory-for-p...).

  • wolf3d

    The original open source release of Wolfenstein 3D

  • It took a long time to write that engine and porting the whole thing properly also takes time. It just moves goalposts. Why didn’t he spend 80M on a new AAA game? If he spent any less than that, he certainly can’t draw any useful conclusions.

    Have you ever looked over the codebase? It’s plenty large enough to draw useful conclusions from for most people let alone someone with his vast game experience.

    https://github.com/id-Software/wolf3d/tree/master/WOLFSRC

    Meanwhile, you are drawing bay conclusions with no credentials out evidence. As to actual games, setting aside the fact that Wolfenstein still sees play, loads of popular games are written in JS. Lots of others are in Java or C#. None of these make your case as Haskell, Ocaml, and StandardML (SML) are in the same performance range.

    As to your argument about the efficiency of objects, what do you think functional languages use? Lets use SML as an example. There’s real arrays and they are also optionally mutable (yes, there’s linked lists too, but those can be used in C++ too).

    Records are basically just C structs (they are immutable by default, but can contain refs which are mutable pointers). They can contain functions because functions are first class without the mess that many languages create.

    You associate functions with datatypes which gives you the best part about methods. They also give you a kind of implicit interface too due to structural typing. I’d note that closures are mathematically equivalent to objects.

    Finally, modules are everything a language like Java tries to get from classes (and more), but without any of the downsides of classes themselves.

    People generally like the JS paradigm of factories and object literals (even if they hate the stuff like dynamic typing or type coercion). StandardML offers the same kinds of patterns, but with sound typing, simpler syntax without the warts, more powerful syntax, and performance in the same range as go or Java.

    To me, your argument sounds like the people arguing that goto is better and more natural than looping constructs or the procedural guys arguing against OOP. I think if you messed around with StandardML, it would change your mind about what programming could be in the future.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Implement React v18 from Scratch Using WASM and Rust - [1] Build the Project

    5 projects | dev.to | 7 Apr 2024
  • Show HN: Flash Attention in ~100 lines of CUDA

    2 projects | news.ycombinator.com | 16 Mar 2024
  • Learning Rust: A clean start

    5 projects | dev.to | 26 Feb 2024
  • Implementing a JIT Compiled Language with Haskell and LLVM (2017)

    1 project | news.ycombinator.com | 24 Feb 2024
  • Halide v17.0.0

    1 project | news.ycombinator.com | 1 Feb 2024