r/functionalprogramming • u/[deleted] • Feb 06 '21
r/functionalprogramming • u/marcelrusu • Aug 04 '20
TypeScript Functional TypeScript | Episode 1 | Higher Order Functions + Closures
r/functionalprogramming • u/[deleted] • Jul 23 '20
Clojure Cognitect Joins Nubank
r/functionalprogramming • u/[deleted] • Jun 19 '20
C 🧮 poica: Algebraic data types & type introspection for pure C!
r/functionalprogramming • u/Myths21 • May 30 '20
Intro to FP Dr Boolean is god sent
I am just amazed at his talents to teach FP via Javascript . I am talking about the course
https://frontendmasters.com/teachers/brian-lonsdorf/
I made few of my hard core imperative team mates watch it and they were so glad they did and allowed me to implement some of the core fp concepts in our upcoming microservice. Hats off to him was wondering if there are others like him, May be some one who can transform the minds of people who think Funtional Programming is just for side gimmicks
r/functionalprogramming • u/MaoStevemao • May 09 '20
Haskell Asynchronous and Parallel Programming in Haskell (Niklas Hambüchen - April 2020)
r/functionalprogramming • u/HaskellAmsterdam • Apr 19 '20
Haskell Mu-Haskell, Easy Micro-service using Type Level - Alejandro Serrano
r/functionalprogramming • u/kvalle • Dec 04 '19
Elm Minesweeper in Elm
r/functionalprogramming • u/defenestrant • Aug 15 '19
JavaScript For my thesis, I made a more efficient virtual keyboard to use with a gamepad/game controller! It's based on the T9 keyboard from old cellphones, written in functional javascript with ReactJS and RamdaJS. Would love some feedback.
Hi, I'm a graduating student and I made this virtual keyboard for a gamepad as my thesis, I would really love your comments guys :)
test it @ Jeight.io
How it works
It works by selecting letters with the 4 directions on each joystick. Like how old cellphones used to have multiple letters on one key, this keyboard has multiple letters on one joystick direction. Powered by a dictionary, you only have to do one action / letter. Jeight will propose the words that you could possibly form with the "letter groups" you've selected.
If the word you want to use does not exist in the dictionary, you can add any word you want in the settings page. As well as choose any color scheme, or choose between a playstation or xbox layout.
Youtube tutorial video (sorry for the length of 6min, it's my first tutorial video)
Features
- 1 action / letter
- powered by a Dictionary (T9)
- test online (HTML5/JS)
- open sourced on Github
- any color scheme!
- Playstation/Xbox layout
Supported browsers
It's written in Javascript and reads the HTML5 Gamepad API to get your controller data. This means you can test it right in your browser at https://jeight.io/prototype.
- Chrome (latest versions)
- Firefox (latest versions)
Feedback
I would really like your feedback guys! Please consider filling out my feedback form. It's 12 small questions and would take 2 minutes top! But I understand if you can't :)
This also counts as to any feedback towards the code. I've learned a lot but there is still such a way to go. One thing I found difficult was to group all these small functions in related files.
I'm open to any help, comments or whatever on github.
Thanks for taking the time to read or test guys :) Really appreciate it. Much love ♥️♥️
r/functionalprogramming • u/mlopes • May 01 '19
Intro to FP Currying and partial application
r/functionalprogramming • u/_akirakai • Jul 04 '18
FP The algebra (and calculus!) of algebraic data types
codewords.recurse.comr/functionalprogramming • u/nextProgramYT • May 14 '25
Question What can I do to get more into the type of programming from "The Evolution of a Haskell Programmer"?
I came across this website here and I'm very interested in this kind of esoteric, pure math meets programming thing. I use C# and C++ at my job, but I took a course in FP in university, so I'm a little bit familiar with what's going on, but not enough to know where to learn more about this.
Does anyone perhaps have a book recommendation about functional programming as it relates to pure math? Or any other resources you know. Thank you.
r/functionalprogramming • u/faiface • Feb 01 '25
FP Par, an experimental concurrent language based on linear logic with an interactive playground
Hey everyone!
I've been fascinated with linear logic, session types, and the concurrent semantics they provide for programming. Over time, I refined some ideas on how a programming language making full use of these could look like, and I think it's time I share it!
Here's a repo with full documentation: https://github.com/faiface/par-lang
Brace yourself, because it doesn't seem unreasonable to consider this a different programming paradigm. It will probably take a little bit of playing with it to fully understand it, but I can promise that once it makes sense, it's quite beautiful, and operationally powerful.
To make it easy to play with, the language offers an interactive playground that supports interacting with everything the language offers. Clicking on buttons to concurrently construct inputs and observing outputs pop up is the jam.
Let me know what you think!
Example code
define tree_of_colors =
.node
(.node
(.empty!)
(.red!)
(.empty!)!)
(.green!)
(.node
(.node
(.empty!)
(.yellow!)
(.empty!)!)
(.blue!)
(.empty!)!)!
define flatten = [tree] chan yield {
let yield = tree begin {
empty? => yield
node[left][value][right]? => do {
let yield = left loop
yield.item(value)
} in right loop
}
yield.empty!
}
define flattened = flatten(tree_of_colors)Some extracts from the language guide:
Par (⅋) is an experimental concurrent programming language. It's an attempt to bring the expressive power of linear logic into practice.
Code executes in sequential processes.
Processes communicate with each other via channels.
Every channel has two end-points, in two different processes.
Two processes share at most one channel.
The previous two properties guarantee, that deadlocks are not possible.
No disconnected, unreachable processes. If we imagine a graph with processes as nodes, and channels as edges, it will always be a single connected tree.
Despite the language being dynamically typed at the moment, the above properties hold. With the exception of no unreachable processes, they also hold statically. A type system with linear types is on the horizon, but I want to fully figure out the semantics first.
All values in Par are channels. Processes are intangible, they only exist by executing, and operating on tangible objects: channels. How can it possibly all be channels?
A list? That's a channel sending all its items in order, then signaling the end.
A function? A channel that receives the function argument, then becomes the result.
An infinite stream? Also a channel! This one will be waiting to receive a signal to either produce the next item, or to close.
Some features important for a real-world language are still missing:
Primitive types, like strings and numbers. However, Par is expressive enough to enable custom representations of numbers, booleans, lists, streams, and so on. Just like λ-calculus, but with channels and expressive concurrency.
Replicable values. But, once again, replication can be implemented manually, for now.
Non-determinism. This can't be implemented manually, but I alredy have a mechanism thought out.
One non-essential feature that I really hope will make it into the language later is reactive values. It's those that update automatically based on their dependencies changing.
Theoretical background
Par is a direct implementation of linear logic. Every operation corresponds to a proof-rule in its sequent calculus formulation. A future type system will have direct correspondence with propositions in linear logic.
The language builds on a process language called CP from Phil Wadler's beautiful paper "Propositions as Sessions".
While Phil didn't intend CP to be a foundation of any practical programming language (instead putting his hopes on GV, a functional language in the same paper), I saw a big potential there.
My contribution is reworking the syntax to be expression-friendly, making it more visually paletable, and adding the whole expression syntax that makes it into a practical language.
r/functionalprogramming • u/StevenJac • Dec 26 '24
Question Are monads inefficient?
I'm trying to incorporate some functional programming techniques into python.
I think I get what monads are.
Basically monad allows you to offload context management logic like error handling, optional values, side effects into monad class's method.
An analogy I heard from here given a pizza ordering process, if something goes wrong like having no more ingredients, instead of refunding money back to the customer and diverting tracks, you keep going forward until you put the money in the pizza box and ship it to the customer. There is only one branch in this process and you can only go forward.
But isn't this really inefficient? If there is a long piece of code, and error occurred in the beginning, then instead of short-circuiting to exit out of the function fast, you are just keep "going with the flow" until the very end of the function to tell you about the error.
r/functionalprogramming • u/faiface • Oct 08 '24
Rust I made practical session types based on linear logic in Rust — 'par'
Hello, everyone!
I'd love to share something I made! It is very much related to functional programming, even though the language of implementation is Rust. (One could argue Rust is a kind of a functional language, though :P)
I've been fascinated by linear logic and session types for a while and found it sad it's not really applied in practice. There is a lot of wonderful research on how concurrency can be made structured and robust this way, here are some papers I'd recommend:
The reason seems to be it's hard to design libraries, or even languages, that employ these concepts in an ergonomic and easy to use way.
So, here's my take on trying to do better. Let me show you a new library I made, which I shamelessly called 'par'.
Crates.io: https://crates.io/crates/par
GitHub: https://github.com/faiface/par
Let me know what you think! If you want to join and contribute, you're very welcome as well!
Features
Specify full concurrent protocols — Sequencing, branching, recursion, higher-order patterns.
Type-checked protocol adherence — Expectations delivered, obligations fulfilled.
Deadlock freedom — Cyclic communication is statically ruled out.
Multiple concurrent participants.
Fits well with Rust's type system:
Use
enums for making choices.Use recursion on types for cyclic protocols.
Built on top of
async/.await. Runtime agnostic.Ergonomic design — eg.
atm.choose(Operation::CheckBalance)Standard patterns in modules:
No unsafe!
Accessible documentation as a learning tool.
r/functionalprogramming • u/crowdhailer • Aug 01 '24
Question Are there any "other" languages with structural effect types?
I've looked at a variety of languages implementing effects, and handlers. For example.
Unison https://www.unison-lang.org/docs/language-reference/abilities-in-function-types/ which marks functions with effects as follows.
I -> {A1,A2} OKoka https://koka-lang.github.io/koka/doc/book.html#sec-semantics-of-effects which marks functions with effects as
int -> <st<h>,pure> int
Both of these, and the other examples I have found, use nominal effects. This means the effects need to be defined up front in a type declaration.
Are there any other languages, even if really niche that use structural effects.
Context, I have implemented structural effects in my language https://eyg.run/documentation/effects. I think structural effects are cool because they remove any need to declare types/effects up front. However I am reaching a point where the design of them is becoming challenging and so it would be good to find any other efforts to handle this design challenge.
Even just writing down the function type is a design challenge. for example if you have a "Log" effect that lifts a string value and lowers unit (an empty record) the best design I have is. I -> <Log(String, {}),..> O (I = input type and O = output type)
r/functionalprogramming • u/No-Condition8771 • Jun 15 '24
Intro to FP Dear FP, today
Dear FP,
Today I was today years old when I wrote my first ever currying function. I feel...euphoric? Emotional? I want to cry with joy? I wish I could explain this to a random stranger or my gf...
I've been doing web programming for 20 years, mostly procedural and OOP, and only really really got into FP a month or two ago. Heard currying a million times. Read it recently a dozen times. Didn't make sense, just seemed overcomplicated. Not today.
<?php
$assertCase = fn ($case) => function ($expected) use ($case, $service) {
$this->assertInstanceOf($expected, $service->cacheGet($case->value), "The {$case->name} token has been set");
};
// Assert both access and refresh tokens have been set.
array_map(
fn ($case) => $assertCase($case)(m\Just::class),
AuthToken::cases()
);
$service->revoke(AuthToken::ACCESS); // Manually invalidate the access token, leaving the refresh token alone.
$assertCase(AuthToken::ACCESS)(m\Nothing::class);
$assertCase(AuthToken::REFRESH)(m\Just::class);I did a non curryied version (of course) of some test state validation I'm doing, and then I want to use array_map, which in PHP only passes one argument to the callable. And then and there that forced the issue. It's like I can hear the bird singing outside right now.
I know this is not Rust, or Haskell. But I'm happy now.
Thank you for this subreddit.
r/functionalprogramming • u/God_of_failure • Mar 14 '24
Question Could you recommend me some popular frameworks or technologies which use Functional programming?
I really enjoy using impure FP with Javascript and I have started learning Huskell, but when in comes to real world applications of FP at the moment I m limited to React.I have also considered F# and Rust but they dont seem to be popular among employers. Are there any other implementations of FP that are used in the job market
r/functionalprogramming • u/bosyluke • Nov 21 '23
FP Roc-lang website update
roc-lang.org website updated with more examples and descriptions of key design goals. 🤘
r/functionalprogramming • u/a-concerned-mother • Jun 30 '23
Haskell Why Learn Haskell in 2023
r/functionalprogramming • u/kinow • Mar 12 '23
FP The semantics of a simple functional language
lawrencecpaulson.github.ior/functionalprogramming • u/kinow • Mar 07 '23
Category Theory Category Theory ∩ Machine Learning
r/functionalprogramming • u/ihid • Feb 27 '23
Training A Brief Introduction to ...
Hi everyone,
We've started putting together a series of introductory videos to different languages. It's called "A Brief Introduction to..." and In each we look at why the language is interesting and Erik solves an Exercism exercise in it.
We've started with several functional languages, which I think may be of interest to people here:
We'll be releasing more videos throughout the year too. I'll try and keep this post up to date :)
This will be my final post of Exercism's Functional February. Thanks to everyone that's taken part - it's been a really fun month, especially because of all the community engagement! On Wednesday we'll be moving into looking at System Languages (e.g. C, Go, Rust, Nim). Several of those have functional programming as a possible usable paradigm. We'll be releasing an overview video of all the languages which discusses that on Monday - so if you're interested in putting your functional skills to use in lower-level languages - keep an eye out for that video too.
r/functionalprogramming • u/kinow • Feb 04 '23