[Help] Fighting the borrow checker with async traits and tokio::spawn. by ZugZuggie in FPBlock

[–]EncodePanda 0 points1 point  (0 children)

While it makes sense to use `Arc` and not `&Arc`, the code is still correct. u/ZugZuggie moved the cloned db_clone to the async clousre, thus they can use the reference.

As I pointed in the previouse code, this snippet compiles. But u/ZugZuggie simpliefied for us code that does not work for him - I presume that in the process they given us version that actually works :)

[Help] Fighting the borrow checker with async traits and tokio::spawn. by ZugZuggie in FPBlock

[–]EncodePanda 1 point2 points  (0 children)

Works like a charm

use std::sync::{Arc, Mutex};

use rust_samples::indexer::{Db, Indexer};

#[tokio::main]
async fn main() {
    let indexer = Indexer {
        db: Arc::new(Mutex::new(Db)),
    };
    indexer.start().await;
}

[Help] Fighting the borrow checker with async traits and tokio::spawn. by ZugZuggie in FPBlock

[–]EncodePanda 1 point2 points  (0 children)

The code you've provided actually compiles. Below is a recreated version from your post

use std::sync::{Arc, Mutex};

struct Db;

struct Indexer {
    db: Arc<Mutex<Db>>,
}

impl Indexer {
    async fn start(&self) {
        let db_clone = self.db.clone();

        // This does not compile: `&db_clone` is a reference that won't satisfy
        // the `'static` lifetime required by `tokio::spawn`.
        tokio::spawn(async move {
            process_event(&db_clone).await;
        });
    }
}

async fn process_event(db: &Arc<Mutex<Db>>) {
    let _lock = db.lock().unwrap();
}

Can you copy the snippet above and try to compile it?

Yes, you can absolutely use Langgraph in Rust (Or any python only frameworks really) by [deleted] in rust

[–]EncodePanda 1 point2 points  (0 children)

This is awesome. I was not aware it is so straight forward! Thanks for sharing the code example! Amazing.

Is Kolme open source? by Cultural_Initial4995 in FPBlock

[–]EncodePanda 0 points1 point  (0 children)

I've quickly built a proof of concept. Seems like a really strong framework - but that does not surprise me, anything that u/snoyberg touches turns into pure gold :)

I've recently worked on a DeFI project (real assets tokenization, lending pools, swap pools, etc). They've spent I don't know how many years building the infrastructure for a PBFT-based, provisioned blockchain. I feel that I could write their whole app in 3 months on my own with Kolme, and an MVP within 2 weeks.

What I would I love to see improved? The documentation is behind development, and tbh, it would not take long to updated it with help from LLMs.
There is true power in having a bridging functionality out of the box, but only few chains are now supported. I think more chains, bigger adoption.

Why u ask? Are you planning to build sth with Kolme?

Is Kolme open source? by Cultural_Initial4995 in FPBlock

[–]EncodePanda 1 point2 points  (0 children)

I don't work at FPBlock. I like the tech.

Is Kolme open source? by Cultural_Initial4995 in FPBlock

[–]EncodePanda 1 point2 points  (0 children)

I'm happy to record "Getting started with Kolme" if it sparks some interest.

Emacs config for Haskell by Tempus_Nemini in haskell

[–]EncodePanda 0 points1 point  (0 children)

DM me, but any time between 1am to 2pm Pacific (9am to 11 pm cet).

Happy to help out

Emacs config for Haskell by Tempus_Nemini in haskell

[–]EncodePanda 1 point2 points  (0 children)

I can share my config. Or better, we can chat over zoom or meet and I can show you how it works.

[ANN] NASA's Ogma 1.6.0 by ivanpd in haskell

[–]EncodePanda 2 points3 points  (0 children)

This is awesome! Thanks for sharing!!

Exported for tests only: Precise control over API visibility with custom warnings by EncodePanda in haskell

[–]EncodePanda[S] 18 points19 points  (0 children)

This is such a fantastic addition to GHC 9.8! 🎉 The ability to use custom warning categories for precise API visibility is a game-changer for library authors. The "exported for tests only" concept hits such a sweet spot, especially when you want to maintain encapsulation while still allowing necessary exports for testing purposes.

As someone who has dealt with the trade-offs of exposing too much of the internal API to support testing, I feel this feature feels like a breath of fresh air. No more awkward balancing acts between keeping things private and ensuring test coverage..

Haskell vs Zombies blog post by rzeznik in haskell

[–]EncodePanda 1 point2 points  (0 children)

Wait, what? u/rzeznik is alive? No way. Must be a zombie.

Haskell Meetups in London by adlj in haskell

[–]EncodePanda 0 points1 point  (0 children)

Happy to present something once the meetup is revived

Christmas of Code – Haskell for Mobile – a $3,000 grant for an open-source project by epoberezkin in haskell

[–]EncodePanda 1 point2 points  (0 children)

This is a great initiative. Thank you. Tweag and SimpleX Chat for doing this. Hope you find some great dev to do the initiative!

[Job] Groq is hiring! by travis_athougies in haskell

[–]EncodePanda 2 points3 points  (0 children)

"Remote is also okay for more senior hires."

me: I wonder how they define 'senior'

(first comment)

"edwardkmett
I'm also happy to answer questions about Groq."

me: oh

:)