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 https://hexdocs.pm/exvalibur/exvalibur.html 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.

Where Next?

Popular in Libraries Top

tompave
Hello there, I would like to share a feature toggles library (AKA feature flags) I’ve been working on. The main package is FunWithFlags...
New
devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: https://github.com/devonestes/assertions ...
New
arkgil
Hi all! I’m happy to announce that Telemetry v0.3.0 is out! This release marks the conversion from Elixir to Erlang so that all the libr...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
blatyo
https://www.conduitframework.com/ The best overview for how things are tied together is this presentation. Modules and functions are pre...
New
benlime
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
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
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
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

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Sub Categories:

We're in Beta

About us Mission Statement