murrgelb

murrgelb

TypeResolver - parse and resolve spec types into convenient structs

TypeResolver is a library, that provides a macro to resolve typespecs. It returns a native type that is represented in easy to handle structs. A native type is a type defined of typespec built-ins - no more user types are referenced, type parameters were resolved, …

E.g. the following call

TypeResolver.resolve(integer() | String.t())

will result in

%TypeResolver.UnionT{
  inner: [%TypeResolver.Types.IntegerT{}, %TypeResolver.Types.BinaryT{}]
}

TypeResolver doesn’t need any compiler modifications and works with macros only.

We saw the need for such a library, since we haven’t found a simple solution to resolve and handle typespecs easily. Using TypeResolver we can now lift typespecs into run time. At some point we will e.g. release a TypedStruct plugin that derives validation based on typespecs.

Happy coding!

https://github.com/bravobike/type-resolver

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
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
anshuman23
Hello all, I have been working on my proposed project called Tensorflex as part of Google Summer of Code 2018.. Tensorflex can be used f...
New
tmbb
I’ve decided to create this topic to discuss optimization possibilities for something like Phoenix LiveView. I’ve created this topic unde...
144 10847 141
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42716 114
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement