mudasobwa

mudasobwa

Creator of Cure

Pyc → Structs on Steroids

Blog post, announcing Pyc package. It allows transparent validation across inserted data with Exvalibur, chaining functions in a monadic-like way, and exposes all the keys as local variables inside methods declared with defmethod (without compilation warnings.)

It also reasonably implements Access behaviour for wrapped structs and Collectable protocol with validation.

https://dev.to/mudasobwa/elixir-structs-on-steroids-5cd9

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hey @mudasobwa. It’s always great to see people take on problems.

There’s a few thing about these libraries that would make them more likely to be used by others. The first big one for Exvalibur is making the source code more readily available. The hexdocs don’t link to any source code, and I couldn’t find it with some cursory googling either. I had to create a project, add it as a dep, and then open the deps directory to get a look at it.

The code contains a LOT of Code. function calls. This is almost always a sign that things aren’t quite right. A lot of it is to support the strings which, as @OvermindDL1 notes, is completely unnecessary because of Elixir’s built in macro support.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Ah, that’s my mistake, the Exvalibur — exvalibur v0.10.0 page looked like the top module doc and I looked for </> and didn’t see it. I see the code now, I wonder why it wasn’t higher on google.

As far as the macros go, it’s a pretty large topic. I’d consider the guides, and the Metaprogramming Elixir book. I’m a little short on time at the moment but I may be able to comment later with more details. The short version is that your Code.string_to_quoted is what the compiler already does. Try using just is_map(val) and see what the input to your function is.

The functions inside Code should basically never be called at runtime. They’re not optimized for it and can lead to a variety of issues.

Last Post!

mudasobwa

mudasobwa

Creator of Cure

Recalled. To be used in config.exs. Also, I should support plain guards, thanks.

Where Next?

Popular in Announcing Top

Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19834 141
New
maltoe
Hello! Came here to announce ChromicPDF, a pet project PDF generator I’ve been working on for the past few months. Why another PDF gener...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10719 134
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44532 311
New

We're in Beta

About us Mission Statement