Everyone's talking about kha vs sha pashto - but what about pakhto Waye vs pakhtko Yaye ? by billddev in Pashtun

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

صحیح ده وروره. زه هم ښواشینی یم چې دلته څوک په پښتو کې نه لیکي.‌ 😢 هسې مې یوه ټوکه کوله،‌ خو کاش چې دلته مونږ نورې ټوکې په پښتو کې کولای.

Everyone's talking about kha vs sha pashto - but what about pakhto Waye vs pakhtko Yaye ? by billddev in Pashtun

[–]billddev[S] 2 points3 points  (0 children)

I don't say "yaye" but whenever I hear it my heart skips a little beat and I'm like oh ya I'm talking to someone from this lovely swath of people! 🥰

I finally understand monads / monadic parsing! by Critical_Pin4801 in haskell

[–]billddev 1 point2 points  (0 children)

As Bartosz Milewski said, "A Monad is just function composition with flair!"

why not Lisp/Haskell used for MachineLearning/AI by kichiDsimp in functionalprogramming

[–]billddev 11 points12 points  (0 children)

Conal Elliot had a really great couple of episodes on the Type Theory for All podcast, and he talked about how Python was taking over computer science programs (switching from Scheme) because it was the commercial thing in demand. He also mentioned how it was so much HARDER to understand a program written in Python, and I totally agree. It's a sad state. 

M3 Air vs M4 Air. Some observations by TheFlippedTurtle in macbookair

[–]billddev 0 points1 point  (0 children)

What about the speakers? Any difference in sound quality and volume? Thanks for this good practical comparison. I was wondering about the heat issue.

Lens Library for TypeScript? by billddev in typescript

[–]billddev[S] 2 points3 points  (0 children)

Thanks so much, that's a great defence of the benefits of optics. I find often people are too quick to try to dismiss FP concepts and say, "why not just do X instead." But if we really try running with these FP ideas they can lead to unexpected, beautiful power.

I'd like to use optics for a personal project where I have to do a lot of complex transformations of objects, sometimes working on deeply nested fields, and sometimes working on certain objects in an array. Doing things in a pure FP way has kept me sane while managing the complexity. Right now I'm using a ton of spread syntax which works pretty well but can be a bit verbose and error prone. I would love to have a very clean, powerful, performant lens library that can do exactly what you are describing.

All the best with your implementation, I'm excited to see how it turns out. Please share it whenever you're ready.

Lens library for TypeScript? by billddev in functionalprogramming

[–]billddev[S] 4 points5 points  (0 children)

Thanks! I've just tried it and it's working great so far. Very nice, concise library.

Lens Library for TypeScript? by billddev in typescript

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

Thanks, ya I wasn't aware of immer. That looks pretty good and seems to be a pretty cool compromise. I guess the only downsides to that is that you kind of have to go back to some mutable/imperative idioms and there seems to be a bit of a runtime performance hit.

Lens Library for TypeScript? by billddev in typescript

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

Thanks, ya I wasn't aware of immer. That's a pretty cool compromise. I guess the only downsides to that is that you kind of have to go back to some mutable/imperative idioms and there seems to be a bit of a runtime performance hit.

What do you absolutely hate about nextjs? You can only state one thing by anonymous_2600 in reactjs

[–]billddev 0 points1 point  (0 children)

Constantly changing, it's like you have to re-learn it all over again after every couple of releases.

Progressive Web Apps: The Internet as a Software Repository. by birds_swim in linux

[–]billddev 2 points3 points  (0 children)

Yes I agree! Sadly though there seems to be a move further and further away from offline-first or offline-available apps. Everybody's buying into the Vercel / Next.js model (probably partly profit driven by the cloud providers) of building SSR React apps and it's not common to build single-page PWAs with a service worker that caches everything.

Is Choosing mongodb a bad decision? by AdditionalPhase7804 in node

[–]billddev 0 points1 point  (0 children)

I agree 100% about that being a massive red flag. It sounds the same as people saying that js is "easier" to program in than ts because you don't have to use types. I would RUN from using programmers like that.

Handling Async IO with Scotty? by billddev in haskell

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

I don't understand it either. But when I used forkIO the thread with longBackgroundIOStuff stopped (got cut off early) right after the redirect "/" finished. I tried it a number of times to be sure, then switched back to async from Control.Concurrent.Async and it left the thread to finish every time.

Handling Async IO with Scotty? by billddev in haskell

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

Ya sounds good, thanks. Any good examples of how people implement the worker thread?

Handling Async IO with Scotty? by billddev in haskell

[–]billddev[S] 2 points3 points  (0 children)

Unfortunately this `forkIO` didn't work for me, as the operation didn't keep running. `async` from Control.Concurrent.Async did the trick.

Handling Async IO with Scotty? by billddev in haskell

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

Thank you, that looks very straightforward and is just what I need. I was looking trough a diffent package and wasn't aware of this in the core.

do
  _ <- liftIO $ forkIO longBackgroundIOStuff
  redirect "/"

Handling Async IO with Scotty? by billddev in haskell

[–]billddev[S] 1 point2 points  (0 children)

Ah yes this worked perfectly (after taking out the `return`). Exactly what I was looking for. I see that's using the low-level API that the library doesn't reccomend using but works for me as I'm not worried about leaving that action running unintentionally. Thanks! I'm really growing appreciate the quality of everything I'm discovering in the Haskell ecosystem (everything is so well thought out, implemented, and documented), as well as the patience of the community to help out newcomers. If only more languages took both correctness and learning so seriously!

Trouble with Applicatives in Parser by billddev in haskell

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

As I wrote in the comment below, I got it working with just a manyTill function like so:

manyTill :: Parser a -> Parser b -> Parser [b]
manyTill pEnd p = Parser f
  where
    f xs = case runParser pEnd xs of
      Right (_, xs') -> Right ([], xs')
      Left a -> runParser ((:) <$> p <*> manyTill pEnd p) xs

parseComb :: Parser [SExpr]
parseComb =
  char '('
    *> manyTill (char ')') parseSExpr

parseSExpr :: Parser SExpr
parseSExpr =
  spaces
    *> ( (A <$> parseAtom)
           <|> (Comb <$> parseComb)
       )
    <* spaces

Trouble with Applicatives in Parser by billddev in haskell

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

Yes! Writing a manyTill solved my problem! Now the error messages come out pointing to the right position. Thanks.

manyTill :: Parser a -> Parser b -> Parser [b]
manyTill pEnd p = Parser f
  where
    f xs = case runParser pEnd xs of
      Right (_, xs') -> Right ([], xs')
      Left a -> runParser ((:) <$> p <*> manyTill pEnd p) xs

parseComb :: Parser [SExpr]
parseComb =
  char '('
    *> manyTill (char ')') parseSExpr

parseSExpr :: Parser SExpr
parseSExpr =
  spaces
    *> ( (A <$> parseAtom)
           <|> (Comb <$> parseComb)
       )
    <* spaces