Motoko async generics solution

The question of how to mix async return types and type parameters has often been raised on the forum. They aren’t allowed in Motoko.

I have written a blog post about my favorite solution, a workaround, which I have used successfully in practice: Asynchronous generics in Motoko - by MR Research AG

Also try it live on embed.motoko.org

If you have any use cases for shareable generics then please post them below.

I have found at least these links where the question was raised, ordered by date:

If you know other link then please post them as well. I would be interested if the workaround is good enough for those use cases or not.

8 Likes

Very cool. I’m wondering if there are some other motoko gotchas that this could apply to.

1 Like