Latest #typespecs Threads 
I’m working on a small library (GitHub - fuelen/mold: A tiny, zero-dependency parsing library for external payloads · GitHub) where schem...
New
I was checking the documentation for elixir and erlang types for ways to represent a map in the typespec.
I have seen different projects...
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
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
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
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
Background
I am doing a small function that takes a few parameters. One such parameter is a float() that must be <= 0.
Now, if this w...
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
If we want to introduce common reusable type, should we introduce separate Types module like so?:
defmodule App.Shared.Types do
@modul...
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
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
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 was checking the documentation for elixir and erlang types for ways to represent a map in the typespec.
I have seen different projects...
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
Last Three Year's Trending
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects.
Core ideas
Type- and function specifications are const...
New
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
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’ve encountered some unusual behavior from Dialyzer while validating values from Application.get_env and reduced it down to the followin...
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
Background
I am doing a small function that takes a few parameters. One such parameter is a float() that must be <= 0.
Now, if this w...
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
This is more of a general question, but I’m wondering how other people in the community think about the pattern matching in function sign...
New
If we have function with typespec that always returns value with incorrect type
@spec hello(integer()) :: map()
def hello(int) do
...
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
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
Background
So I have a behaviour that has some functions with optional parameters and I want a way to make them more readable:
@type o...
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
- 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:
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
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









