Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opaque typespecs #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add opaque typespecs #14

wants to merge 1 commit into from

Conversation

schutm
Copy link

@schutm schutm commented Feb 7, 2023

I've added the possibility to have @type-specs added as @opaque-specs. I like to keep my structures hidden, so I'm able to change the types and other stuff.

So the following will create a opaque typespec for Person.t().

defmodule Entities do
  use Strukt

  defstruct Person do
    @opaque_fields true

    field :name, :string, required: true

    def name(person), do: person.name
  end
end

I'm not sure, whether:

  • this is a good addition to this library;
  • if the chosen interface is desirable;
  • the implementation is any good.

Any thoughts are appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant