Experimental TS wrapper for Fauna #434
cjol
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A little while ago, I started a FaunaDB project, and quickly grew frustrated with the experience of writing complex FQL queries. Observability of intermediate results has already been discussed as a problem (you typically only get to see the final result, and if it's not what you expect then it's hard to debug along the way). Another problem I was having is that FQL feels like a functional programming language in many ways, but we lack tools like function composition to really write queries in a functional "style".
I tried to solve both problems for myself with a wrapper library imaginatively called
fauna-fp
. To save you a click, here's a quick demo:With almost no type annotations, the transformations at each step of the way infer types such that the inferred type of
insertedEmail
isQuery<string>
(and executing the query gives an inferred result ofstring
).It was a fun project, and I think there's potential to expand on it but I think I bit off more than I can chew by trying to provide both solid typings and the function compositional style in one go. I am not sure that I can justify spending much more time on the project going forward, but I thought it was worth sharing here in case it serves as inspiration for anyone else!
Beta Was this translation helpful? Give feedback.
All reactions