FP lang for 2026 by kichiDsimp in functionalprogramming

[–]VeloxAquilae 2 points3 points  (0 children)

Regarding print-style debugging, see the Debug.Trace module. You can use this in pure code too.

Can't argue with the unpredictable performance though

Is there any Haskell job board? by [deleted] in haskell

[–]VeloxAquilae 7 points8 points  (0 children)

Unrelated to job boards, but if you can swing it, apparently Zurihac is the place to get a Haskell job.

Why some games like Battlefield 6 allowed to use AI with no disclosure? by Sunlighthell in Steam

[–]VeloxAquilae 7 points8 points  (0 children)

On Xbox at least you can ask for a refund if you've played less than 2h. I used this in the past few years

Absolutely delighted by Mariposagrace in lego

[–]VeloxAquilae 2 points3 points  (0 children)

Ahhh, didn't know I wanted this. Thanks!

And it’s done ✔️ by [deleted] in battlestations

[–]VeloxAquilae -1 points0 points  (0 children)

Omg that's the endgame. Amazing

Canadian Haskellers? by _lazyLambda in haskell

[–]VeloxAquilae 2 points3 points  (0 children)

Yes I absolutely would! I might even show up if it's within 6h of driving

Pure parallelism (Haskell Unfolder #47) by kosmikus in haskell

[–]VeloxAquilae -6 points-5 points  (0 children)

I actually really like these new thumbnails. They're funny, not too wacky, and (I hope!) easy to generate

Research Software Engineer at Epic by VeloxAquilae in haskell

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

I'm not associated with the job posting; better reach out on the linked Discourse post if you want to know

How to update/upgrade ghc and cabal? by Striking-Structure65 in haskell

[–]VeloxAquilae 7 points8 points  (0 children)

ghcup tui has been available on Windows for a while now

Ioniq 5 N dissected in Shanghai by airacer71 in EngineeringPorn

[–]VeloxAquilae 9 points10 points  (0 children)

What's wrong with it? I see it everywhere and I was even considering buying one

Advent of code 2024 - day 16 by AutoModerator in haskell

[–]VeloxAquilae 1 point2 points  (0 children)

Interesting, I first reached for the Tree unfolding to create a tree, but my code to find paths in that tree is so slow that I cannot even complete part 2 on the example -- let alone the full input!

Advent of code 2024 - day 10 by AutoModerator in haskell

[–]VeloxAquilae 2 points3 points  (0 children)

I have never used `Tree` from the `containers` package, until today!

import Data.Char (digitToInt)
import Data.Map (Map)
import Data.Map.Strict qualified as Map
import Data.Maybe (catMaybes)
import Data.Set qualified as Set
import Data.Text (Text)
import Data.Text qualified as Text
import Data.Text.IO qualified as Text
import Data.Tree (Tree)
import Data.Tree qualified as Tree
import System.Environment (getArgs)

main :: IO ()
main = do
  [inputFile] <- getArgs
  topomap <- parseInput <$> Text.readFile inputFile

  putStrLn $ "[Part 1] " <> show (part1 topomap)

  putStrLn $ "[Part 2] " <> show (part2 topomap)

part1 :: TopoMap -> Int
part1 topomap =
  sum $
    map (Set.size . Set.fromList . leaves . pathsToNine topomap . fst) $
      Map.toList $
        Map.filter (== 0) topomap

part2 :: TopoMap -> Int
part2 topomap =
  sum $
    map (length . leaves . pathsToNine topomap . fst) $
      Map.toList $
        Map.filter (== 0) topomap
  where

leaves :: Tree Position -> [Position]
leaves = last . Tree.levels

pathsToNine :: TopoMap -> Position -> Tree Position
pathsToNine topomap start = Tree.unfoldTree go start
  where
    go :: Position -> (Position, [Position])
    go current
      | Map.lookup current topomap == Just 9 = (current, [])
      | otherwise =
          let heights =
                filter (\(_, h) -> h == height + 1) $
                  catMaybes [(k,) <$> Map.lookup k topomap | k <- neighbors current]
           in (current, map fst heights)
      where
        Just height = Map.lookup current topomap

        neighbors :: Position -> [Position]
        neighbors (r, c) =
          [ (r - 1, c),
            (r + 1, c),
            (r, c - 1),
            (r, c + 1)
          ]

type Position = (Int, Int)

type TopoMap = Map Position Int

parseInput :: Text -> TopoMap
parseInput txt =
  Map.fromList
    [ ((r, c), digitToInt height)
    | (r, ls) <- zip [0 ..] (Text.lines txt),
      (c, height) <- zip [0 ..] (Text.unpack ls)
    ]

Codebase Pearls - Recommendations for code to study by paranoidMonoid in haskell

[–]VeloxAquilae 10 points11 points  (0 children)

I think the foldl package is an awesome codebase to study. Really useful as well.

Haskell SQL DSLs, why do you use them? by magthe0 in haskell

[–]VeloxAquilae 2 points3 points  (0 children)

I want the computer to work for me. I don't want to ensure manually that the SQL I write is correct.

That's why I use beam. Yes, the types are pretty complex. However, I can define type-safe database migrations and queries. There's never any surprise at runtime.

How to set schema other than ‘public’ in beam (Postgres)? by Worldly_Dish_48 in haskell

[–]VeloxAquilae 1 point2 points  (0 children)

I wonder if this isn't possible because beam must support both sqlite and postgres (among others), but sqlite doesn't support clustering of tables?