This Week's Trending
This Month's Trending
This Year's Trending
I am about to publish a few projects, and I even though they are currently licensed under the MIT license, I came to the unexpected reali...
New
I’m working on a small library (GitHub - fuelen/mold: A tiny, zero-dependency parsing library for external payloads · GitHub) where schem...
New
Last Three Year's Trending
I was hoping I could get something like this working:
defmodule FooRegistry do
@foos [
FirstFoo,
SecondFoo,
ThirdFoo
]
...
New
I’d like to use typespecs to document that certain functions take one of a few different tensors with specific shape/values like
@type m...
New
I’m looking at an existing project with code like this:
@spec default_rating :: List.t()
@spec default_rating(non_neg_integer()) :: ...
New
If we want to introduce common reusable type, should we introduce separate Types module like so?:
defmodule App.Shared.Types do
@modul...
New
The Typespecs reference section in the Elixir docs states the following:
Some shorthands are allowed, such as [...] , <<>> ...
New
When adding a @spec to a function, is there any functional difference between doing something like
@spec my_func(input :: binary()) :: a...
New
Hi everyone :waving_hand:
I’m trying to improve the typespecs in my application contexts, but I’m running into dialyzer errors when deal...
New
I need to get specs for the function which may be located in the external module, like Process or :math.
Dialyzer source code does rough...
New
For a list of integers, I can simply write a typespec like this:
@type foo() :: [integer()] # or list(integer())
But what about a Strea...
New
Background
I have a structure where the new function requires a parameter to be part of a closed set of values (think of it as an enum). ...
New
I’d recently was asked why you couldn’t get help on types via the IEx t helper with Nerves. The reason is that the type docs are in the B...
New
I’ve encountered some unusual behavior from Dialyzer while validating values from Application.get_env and reduced it down to the followin...
New
I’m writing a multiset library. It’s got 2 modules: one which works on raw “multisets” (which are maps of elements to quantities), and an...
New
What’s the type to use for a function that returns a quote?
For example:
@spec f() :: what_goes_here
def f() do
quote do
code
e...
New
Hi folks,
I want to create a function spec which tells the compiler that the return type will be conforming to a given Behavior. This qu...
New
Trending Over Three Years
Expanding on this topic: Map typespec question
Let’s say I have a map with required and optional keys. I’d like to document both, but ba...
New
I’m pretty new to Elixir. One thing I don’t think I understand is the typespecs, specifically when they deal with structs. A common patt...
New
I have an Ecto schema and I am wondering about how to represent it in typespecs.
Suppose that my schema is like this:
defmodule User do...
New
If we have function with typespec that always returns value with incorrect type
@spec hello(integer()) :: map()
def hello(int) do
...
New
Is there a way to define a function type and use it later in the specs? Something like
@type task :: fun(any) -> {:ok, pid} | {:error...
New
Hi,
I’m trying to find examples of typespec usage with optional arguments. I assume the following is one way to write a spec with option...
New
I want to define a type using typespec like
@type foo :: "bar" | "baz"
But the compiler shows the following error
unexpected expressi...
New
For example I have multiple currencies
dollar.ex
defmodule Multicurrency.Currency.Dollar do
@enforce_keys [:amount]
defstruct [:amo...
New
Given this module:
defmodule A do
@type size :: pos_integer()
defguard is_size(x) when is_integer(x) and x > 0
def default_size...
New
I’ve got an Ecto schema that has a column where I store some random data from a 3rd-party provider. This is mostly just for book-keeping...
New
I’ve learnt that phx.gen.auth uses Base.url_encode64() to convert binary() to String.t(). If I just pass a binary, consumer would malfun...
New
I wrapped an API using pagination with Stream.unfold so that it returns Enum.t (Enumerable.t).
Is it possible to specify @spec of values...
New
NOTE all these questions are related to my use of dialyxir.
Type variables
From the erlang documentation.
Type variables can be used i...
New
Hi,
Is there any way to specify a map or a structure extension using typespecs, e.g.:
@type map1() :: %{
field1: String.t(),
field2...
New
I’m confused… when grooming the docs for https://elixir-lang.org/getting-started/typespecs-and-behaviours.html I got the feedback that mu...
New
- Follow
- Join
- Shape
the conversation
Latest on Elixir Forum
Get money off!
The Pragmatic Bookshelf
35% off any eBook
Manning Publications
45% off any item
ElixirCasts
10% off for life
The Pragmatic Studio
20% off any course
AppSignal
10% off for 12 months
Honeybadger
10% off for 12 months
Simply use coupon code "devtalk.com" or "elixirforum" at checkout!
Filter by Type:
Sub Categories:
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #ai
- #graphql
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









