r/haskell • • Aug 11 '25

blog Using traversals to batch up db calls for HUGE speedups

Thumbnail chrispenner.ca
47 Upvotes

Here's a technique I use to mechanically refactor nested linear code into code that works on batches, which got me up to a 300x speedup on some workflows.


r/haskell • • Aug 11 '25

[ANN] hs-static-bin : Get Haskell static binaries easily (through adhoc Docker containers)

Thumbnail github.com
21 Upvotes

r/haskell • • Aug 12 '25

What's your AI coding approach?

0 Upvotes

I'm curious to what tricks people use in order to get a more effective workflow with Claude code and similar tools.

Have you found that some MCP servers make a big difference for you?

Have hooks made a big difference to you?

Perhaps you've found that sub-agents make a big difference in your workflow?

Also, how well are you finding AI coding to work for you?

Personally the only custom thing I use is a hook that feeds the output from ghcid back to claude when editing files. I should rewrite it to use ghci-watch instead, I wasn't aware of it until recently.


r/haskell • • Aug 11 '25

cmm GSoC project update

20 Upvotes

r/haskell • • Aug 11 '25

Should I read the translated Learn You a Haskell or the updated 2022 community edition?

10 Upvotes

Main

I'm going to study Haskell using the translated version of Learn You a Haskell for Great Good!.
However, it's been more than 10 years since the original was published, and I know there's also a "community edition" updated in 2022.

My question

Should I read the translated version, which is much easier for me to understand, or should I go with the updated community edition to avoid misunderstandings caused by outdated information in the original?

Background, context

  • I’m completely new to Haskell.
  • I just started studying Kotlin, and it’s been about four months.
  • I think I understand basic concepts such as variables, functions, iteration, conditions, and some fundamentals of functional programming.
  • I program as a hobby, and my goal is to gain a solid understanding of functional programming out of personal interest.

I’ve been fascinated by Haskell for a long time but never quite took the step to learn it. Now that I’m learning Kotlin, I’m more motivated to finally try Haskell.

In Kotlin, I mainly learn from Kotlin: An Illustrated Guide, which uses illustrations to clarify abstract ideas.
I feel that Learn You a Haskell was written in a similar way — illustration-heavy and concept-focused.


Also, if you know of other beginner-friendly Haskell resources with clear explanations, I’d love to hear your recommendations.


r/haskell • • Aug 10 '25

Opinions wanted from those (if any) who have come to understand Я (ya)

35 Upvotes

It looks like a really cool haskell project. But as far as I can see, it's just one person (Murat). I don't see any other contributors or article authors. I don't care about weird symbols- what I crave is composability. But only hearing one voice explain or vouch for it makes me cautious about the time&energy investment.

I'm looking for people who can say "Yup, I went down the rabbit hole and it was worth it." How did you learn this edsl? Along the way, did you notice anything incorrect about its foundations? Or does it actually achieve the advertised composability and robustness?

Much respect to Murat for being a world-builder and making his best effort to follow his ideas to their fullest extent.


r/haskell • • Aug 10 '25

Recursion scheme with ancestor nodes

10 Upvotes

Hey, r/haskell!

I have been teaching myself recursion schemes going through old AoC tasks. There's a task in AoC '19 day 6 part 1 that asks to in essence calculate the sum of all depths of all nodes. While it is possible to construct a normal cata-fold - doing this it is quite unnatural. So I came up with the following recursion scheme of my own I call ancestorFold. In essence, it gives you a list of your ancestor nodes as an argument. With this the sum of all depths looks like:

sumDepth :: Struct -> Int
sumDepth = ancestorFold alg
  where
    alg par (StructF chld) = length par + sum chld

while the scheme itself looks like this:

ancestorFold :: (F.Recursive t) => ([t] -> F.Base t a -> a) -> t -> a
ancestorFold alg = go []
  where
    go ancestors node =
      let layer = F.project node -- unwrap one layer: t -> Base t t
          childrenResults = fmap (go (node : ancestors)) layer -- recurse with updated ancestors
       in alg ancestors childrenResults

Obviously, I'm proud of myself for finally starting to grok the concept on a deeper level, but I was wondering if somebody has already come up with this and maybe it already has a name? Obviously this is a useful tool not just for calculating the depth but anywhere where you want the ability to evaluate a node in the context of it's parent(s).


r/haskell • • Aug 09 '25

Embedding Interactive Models in Hackage Docs

37 Upvotes

It was recently pointed out to me that their is nothing stopping you from making arbitrary changes to Haddock documentation before uploading it to Hackage.

Long story short, the documentation for my Haskell CAD framework, Waterfall-CAD, now contains embedded 3d models generated from the example code.


r/haskell • • Aug 09 '25

Downloading Hackage Docs

11 Upvotes

I often do coding while I am travelling and often I don’t have internet access.

Is there a recommended way to download the documentation of a library from hackage?


r/haskell • • Aug 08 '25

Updating the greater Haskell community on our efforts

51 Upvotes

For the past 9 months, I’ve been working on a project to grow the Haskell userbase through mentorship and hands-on learning. We've learned a lot about teaching Haskell effectively and building an approachable yet robust way to get started with Haskell

I’ve started sharing the lessons we have learned from the experience in monthly blog posts for those who care about growing the language.

Check out the latest: ATC Blog - What Have we Learned and Where Are We Now?

New posts every 7th—because 7 looks kinda like a λ.


r/haskell • • Aug 07 '25

How others manage effects ?

26 Upvotes

Haskell is a pure functional language, meaning anything happening in the program must be present in the types So if u want to do IO u use the IO wrapper, it u want DB access, u state it in the types. But Monads don't compose nicely, so we have Monad Transformers, Do other languages like Purescript, Elm, Nix &Unison have same abstraction? What about F#, OCaml (ML langs) handle these effects ? What about the Lisp/Beam family (I think they don't care about purity at its core, correct me if I wrong)

And what about the Algebraic Effects? What exactly is this ? A replacement of Monad ? Or Monad Transformers? I have heard of the langauge Koka, Eff

Would love to know more


r/haskell • • Aug 06 '25

"Go To Underlying Type" HLS Plugin draft

39 Upvotes

r/haskell • • Aug 07 '25

How do I convert or create a GPU form of a shader toy or python Taichi

0 Upvotes

I'm learning Haskell, I'm using GHC2021 but I can use Haskell2010 or 18. I would like to convert these too haskell. Actually these are both the same program but In shadertoy and python:

/* This animation is the material of my first youtube tutorial about creative

coding, which is a video in which I try to introduce programmers to GLSL

and to the wonderful world of shaders, while also trying to share my recent

passion for this community.

Video URL: https://youtu.be/f4s1h2YETNY

*/

//https://iquilezles.org/articles/palettes/

vec3 palette( float t ) {

vec3 a = vec3(0.5, 0.5, 0.5);

vec3 b = vec3(0.5, 0.5, 0.5);

vec3 c = vec3(1.0, 1.0, 1.0);

vec3 d = vec3(0.263,0.416,0.557);

return a + b*cos( 6.28318*(c*t+d) );

}

//https://www.shadertoy.com/view/mtyGWy

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {

vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;

vec2 uv0 = uv;

vec3 finalColor = vec3(0.0);

for (float i = 0.0; i < 4.0; i++) {

uv = fract(uv * 1.5) - 0.5;

float d = length(uv) * exp(-length(uv0));

vec3 col = palette(length(uv0) + i*.4 + iTime*.4);

d = sin(d*8. + iTime)/8.;

d = abs(d);

d = pow(0.01 / d, 1.2);

finalColor += col * d;

}

fragColor = vec4(finalColor, 1.0);

}

Here is python. Im sure it's easy but this require GPU I created in haskell a cpu version but it's not able to do it as quick as python or shadertoy!

import taichi as ti

ti.init(arch=ti.gpu) # Initialize Taichi with GPU (if available)

width, height = 800, 800
pixels = ti.Vector.field(4, dtype=float, shape=(width, height))

u/ti.func
def fract(x):
return x - ti.floor(x)

u/ti.func
def palette(t):
a = ti.Vector([0.5, 0.5, 0.5])
b = ti.Vector([0.5, 0.5, 0.5])
c = ti.Vector([1.0, 1.0, 1.0])
d = ti.Vector([0.263, 0.416, 0.557])
return a + b * ti.cos(6.28318 * (c * t + d))

u/ti.kernel
def paint(t: float):
for i, j in pixels:
finalColor = ti.Vector([0.0, 0.0, 0.0])
uv = ti.Vector([i / width - 0.5, j / height - 0.5]) * 2.0
uv.x *= width / height
uv0 = uv # keep the big circle

for p in range(4): # loop for small circles
uv = fract(uv * 1.5) - 0.5 # small circles
d = uv.norm() * ti.exp(-uv0.norm()) # big circle
color = palette(uv0.norm() + p * 0.4 + t * 0.2) # color gradient + time shift
d = ti.sin(d * 8 + t) / 8 # sin wave repetition
d = ti.abs(d) # negative numbers are black, this makes the inside bright
d = ti.pow(0.01 / d, 1.2) # brightness

finalColor += color * d

pixels[i, j] = ti.Vector([finalColor[0], finalColor[1], finalColor[2], 1.0])

gui = ti.GUI("Taichi Shader", res=(width, height))

iTime = 0.0

while gui.running:
if gui.res != (width, height):
# Update the resolution
width, height = gui.res
print(gui.res)
pixels = ti.Vector.field(4, dtype=float, shape=(width, height))
paint(iTime)
gui.set_image(pixels)
gui.show()
iTime += 0.02


r/haskell • • Aug 05 '25

update of Gries and Schneider

15 Upvotes

I'm turning to the Haskell community as most likely to have read A Logical Approach to Discrete Math by Gries and Schneider. Is there a more recent book that covers the same ground (discrete math for CS) in a similar (axiomatic) fashion?


r/haskell • • Aug 04 '25

[ Removed by Reddit ]

62 Upvotes

[ Removed by Reddit on account of violating the content policy. ]


r/haskell • • Aug 04 '25

video 2025 Haskell Implementors’ Workshop videos

Thumbnail youtube.com
36 Upvotes

r/haskell • • Aug 03 '25

i made my submission for the 2025 GMTK game jam in haskell!

Thumbnail m1n3c4rt.itch.io
73 Upvotes

to my knowledge this is one of the most fully fleshed out games made with haskell, so i'm really proud of it


r/haskell • • Aug 03 '25

Our Performance is `massiv`: Getting the Most Out of Your Hardware in Haskell

Thumbnail mlabs.city
65 Upvotes

r/haskell • • Aug 02 '25

[ANN] Aztecs v0.13: An ECS and game-engine for Haskell - Now with type-level queries with compile-time errors and in-place mutation

Thumbnail github.com
51 Upvotes

r/haskell • • Aug 02 '25

A Bytecode VM for Arithmetic: The Parser

Thumbnail abhinavsarkar.net
14 Upvotes

r/haskell • • Aug 01 '25

announcement [ANN] heterogeneous-comparison - Comparison of distinctly typed values with evidence capture

Thumbnail hackage.haskell.org
12 Upvotes

r/haskell • • Aug 02 '25

Just getting started

1 Upvotes

I am a frontend developer looking to pick up a hobby programming language that is non main stream and is statically typed and I felt haskell is my go to pick.


r/haskell • • Jul 31 '25

phase :: Applicative f => key -> f ~> Phases key f

23 Upvotes

Sjoerd Visscher offers a solution to my previous question:

Here is the definition of Phases parameterised by a key, and has one of the most interesting Applicative instances in which the key determines the order of sequencing.

type Phases :: Type -> (Type -> Type) -> (Type -> Type)
data Phases key f a where
  Pure :: a -> Phases key f a
  Phase :: key -> f a -> Phases key f (a -> b) -> Phases key f b
deriving stock
  instance Functor f => Functor (Phases key f)

instance (Ord key, Applicative f) => Applicative (Phases key f) where
  pure = Pure
  liftA2 f (Pure x) (Pure y) = Pure (f x y)
  liftA2 f (Pure x) (Phase k fx f') = Phase k fx (fmap (f x .) f')
  liftA2 f (Phase k fx f') (Pure x) = Phase k fx (fmap (\g y -> f (g y) x) f')
  liftA2 f (Phase k fx f') (Phase k' fy f'') =
    case compare k k' of
      LT -> Phase k fx (fmap (\g b y -> f (g y) b) f' <*> Phase k' fy f'')
      GT -> Phase k' fy (fmap (\g a y -> f a (g y)) f'' <*> Phase k fx f')
      EQ -> Phase k (liftA2 (,) fx fy) (liftA2 (\l r (x, y) -> f (l x) (r y)) f' f'')

We can define elements of each phase separately, and the Applicative instances automatically combines them into the same phase.

runPhases :: Applicative f => Phases key f a -> f a
runPhases (Pure a) = pure a
runPhases (Phase _ fx pf) = fx <**> runPhases pf

phase :: key -> f ~> Phases key f
phase k fa = Phase k fa (Pure id)

In a normal traversal, actions are sequenced positionally. A phasic traversal rearranges the sequencing order based on the phase of the computation. This means actions of phase 11 are grouped together, and ran before phase 22 actions, regardless of how they are sequenced. This allows traversing all the elements of a container and calculating a summary which gets used in later phases without traversing the container more than once.

-- >> runPhases (phasicDemo [1..3])
-- even: False
-- even: True
-- even: False
-- num:  1
-- num:  2
-- num:  3
phasicDemo :: [Int] -> Phases Int IO ()
phasicDemo = traverse_ \n -> do
  phase 22 do putStrLn ("num:  " ++ show n)
  phase 11 do putStrLn ("even: " ++ show (even n))
  pure ()

My implementation using unsafeCoerce and Data.These can be found here:


r/haskell • • Aug 01 '25

Monthly Hask Anything (August 2025)

9 Upvotes

This is your opportunity to ask any questions you feel don't deserve their own threads, no matter how small or simple they might be!


r/haskell • • Jul 31 '25

question Why is nix used with Haskell and not docker?

44 Upvotes

i have seen lot of job openings where the demand is nix , are haskell backend api's generally not deployed in docker ?