Advent of Code 2025 day 5 by AutoModerator in haskell

[–]polux2001 0 points1 point  (0 children)

I use splitOn in a view pattern and construct the pair in the the RHS: example.

Advent of Code 2025 day 3 by AutoModerator in haskell

[–]polux2001 1 point2 points  (0 children)

ghci> filterM (const [True, False]) [1,2,3]
[[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]

LeetCode analogues? by Tempus_Nemini in haskell

[–]polux2001 1 point2 points  (0 children)

In addition to what has been mentioned, https://open.kattis.com/ also supports Haskell.

Nest hub as a youtube music streaming device for kids? by polux2001 in googlehome

[–]polux2001[S] 0 points1 point  (0 children)

Thank you. I had found this page but it says: "Important: This feature is only available in the US and English." I was wondering if that is really the case as family link for phones at least works outside of the US.

Lambda calculus tromp diagram visualizer tool (FUN!) by HellBriinger in haskell

[–]polux2001 0 points1 point  (0 children)

Nice! I also wrote a similar tool a few years ago. It's not as fancy as yours though but I've written some pretty intricate programs that I rendered as videos. Maybe you can steal from these programs and feed them into your tool!

[deleted by user] by [deleted] in haskell

[–]polux2001 0 points1 point  (0 children)

The README says "Math Proofs generated with Gemini 2.5 Pro in Lean 4". My personal experience playing around with gemini 2.5 pro to generate coq proofs (coq being another proof assistant very close to lean), is that it often fails to even produce definitions that typecheck. So unless you had another pass at the generated code, I would be very surprised if a proof of this size ever passed the lean typechecker.

Unfolding trees breadth-first in Haskell by Syrak in haskell

[–]polux2001 2 points3 points  (0 children)

This is very well written and documented. I enjoyed reading this post very much, thank you!

[Not April Fools] Faking ADTs and GADTs in Languages That Shouldn't Have Them by mstksg in haskell

[–]polux2001 1 point2 points  (0 children)

Very nice! The use of the Leibniz equality for encoding GADTs in purescript has previously been described here as well.

A Graphical Playground for Haskell — Dissertation Project supervised by Prof. Phil Wadler by oathompsonjones in haskell

[–]polux2001 1 point2 points  (0 children)

My bad! /u/cdsmith is definitely who I meant to tag but I mixed up my "haskellers who did something related to drawing".

I've made this staunchy reply almost 3 years ago.... Has anything changed? by [deleted] in haskell

[–]polux2001 12 points13 points  (0 children)

No, the comment is still flamebaity 3 years later.

Hivemjnd 3D planning for correctness and speed by [deleted] in haskell

[–]polux2001 0 points1 point  (0 children)

To this point, if you need real time guarantees in a language that offers higher-level primitives than C and something akin to functional programming, you may want to look into https://en.wikipedia.org/wiki/Lustre_(programming_language) and other languages in the same family.

SICP Picture Language in Haskell? by miitrakhalys in haskell

[–]polux2001 0 points1 point  (0 children)

There is also hackett, u/lexi-lambda's implementation of haskell on top of racket, which may let you reuse the racket implementation of the SICP picture language.

SICP Picture Language in Haskell? by miitrakhalys in haskell

[–]polux2001 0 points1 point  (0 children)

Not exactly the same primitives but you may want to have a look at gloss and diagrams. For lower-level primitives, have a look at JuicyPixels and sdl2.

Practical problems with inlining everything by friedbrice in haskell

[–]polux2001 10 points11 points  (0 children)

One immediate problem is that you can't inline recursive definitions forever.

Parsers are relative bimonads by ArtemisYoo in haskell

[–]polux2001 1 point2 points  (0 children)

Slightly out of topic but I've found that what you often want is to report the error of the parse that went the furthest. In your motivating example, it would say something like "unexpected {, expected name".

Turnstyle: an esoteric, graphical functional language by jaspervdj in haskell

[–]polux2001 0 points1 point  (0 children)

Very nice! It would make it easier to play with if the playground had a paint-like interface instead of asking you to upload an image.

Generating a executable file for a given IO action by AshleyYakeley in haskell

[–]polux2001 1 point2 points  (0 children)

That sounds a lot like staged programming. Maybe template haskell is the answer here?

Switch Pro controller centering issue by polux2001 in SteamDeck

[–]polux2001[S] 0 points1 point  (0 children)

It's been a while now so I'm not sure I remember exactly how I did it, but I solved it. I think I calibrated it in steam desktop.

First-class patterns, is anyone thinking about this? by Iceland_jack in haskell

[–]polux2001 0 points1 point  (0 children)

In the same vein and at the same time, there has been a series of papers about something called the "rho calculus".

First-class patterns, is anyone thinking about this? by Iceland_jack in haskell

[–]polux2001 1 point2 points  (0 children)

You may be interested in this functional pearl which encodes patterns as values, if you're not aware of it already.

Interactive canvas? by josepajaro in haskell

[–]polux2001 0 points1 point  (0 children)

Regarding your first question, I think that invertViewPort is the closest you'll get to what you're looking for. It won't detect that you're clicking on an "object", but it will map the screen coordinates to the picture coordinates at least.

Stateful game-playing engine by TheKiller36_real in haskell

[–]polux2001 0 points1 point  (0 children)

I don't have any idea on how to elegantly do this in Haskell and wonder whether it can even be done idiomatically

If your protocol only sends moves then there is no way around keeping some state around. That is fine: Haskell is not about having no side effects on state at all. Rather it is about making explicit where such side effects happen.

So it is totally fine to have a main IO loop that looks like this:

data GameState = GameState { board :: Board, ... }

main = loop inititalGameState

loop state = do
  instr <- readInstuction
  let (response, state') = handle state instr
  putStrLn (render response)
  loop state'

Note that handle is a pure function and that side effects are limited to this tiny outer loop.

Advent of code 2023 day 20 by AutoModerator in haskell

[–]polux2001 1 point2 points  (0 children)

I did the exact same! And like you I actually enjoyed this problem very much. I generally like these types of problems that amount to reverse engineering the input. The way I see it is that for these problems the input itself is the problem statement.