Hi I started to implement such a library, but I would much prefer to use an existing one. I was unable to find any, wild you be able to share some links?
Thanks, Louis On Fri, 23 Feb 2018, 18:09 OvermindDL1, <[email protected]> wrote: > There are some library that add sum types to Elixir that do 'some' > compile-time checks (like case's and so forth). It would be useful built > in to elixir (though not any of the current library implementations) but > the libraries already do support much of it. > > > On Friday, February 16, 2018 at 6:35:03 AM UTC-7, Ben Wilson wrote: >> >> Can you elaborate on the safety provided by doing `%Struct{} = ` on a >> function? There are no compile time checks that calls to that function are >> actually of that struct type, just runtime checks on the data. Put another >> way this isn't really a type check, but an assertion. >> >> On Friday, February 16, 2018 at 6:38:07 AM UTC-5, [email protected] >> wrote: >>> >>> Hey Louis, >>> >>> I think it should include compile time checks. Mostly I would expect >>> those for function headers, case blocks and with blocks. >>> >>> Dialyzer already checks many of those conditions, but I would like to go >>> a step further. >>> Your mentioned library looks really interesting. Making it work together >>> with existing type specifications would be really cool. >>> >>> With for example structs, I can achieve safety really easy by adding >>> *%Struct{} >>> = my_input* to the function header. >>> >>> I would like to have a mechanism that works similarly, but additionally >>> checks uncovered types of a sum. (If you would for example not cover the >>> None of a Maybe) >>> >>> I think that this could tremendously improve the code quality. >>> >>> Cheers, >>> Jony >>> >>> Am Freitag, 16. Februar 2018 11:57:00 UTC+1 schrieb Louis Pilfold: >>>> >>>> Hey Jony >>>> >>>> Would this involve some form of compile time type checking for these >>>> values? If not we already have them in the form of tuples. >>>> >>>> @type result :: {:ok, string()} | {:error, string()} >>>> >>>> If you want compile time checks this would be more difficult. I've >>>> experimented a little with compile time checks with macros, check it out >>>> here -> https://github.com/lpil/sum >>>> >>>> Cheers, >>>> Louis >>>> >>>> On Fri, 16 Feb 2018 at 10:33 <[email protected]> wrote: >>>> >>>>> Hi all, >>>>> >>>>> First I want to thank you all for your great work on the elixir >>>>> language! >>>>> >>>>> Have there been some thoughts to introduce Tagged Unions into elixir? >>>>> I would really love to use sum types like Either or simple enums in my >>>>> daily work and have some support of the language in handling them. >>>>> >>>>> What do you think about this? >>>>> >>>>> Cheers, >>>>> Jony >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "elixir-lang-core" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/elixir-lang-core/4052d8d9-6eda-46c9-b259-fb0f2e041120%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/elixir-lang-core/4052d8d9-6eda-46c9-b259-fb0f2e041120%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/d1ac20e5-9198-47d1-91c4-cf6d6b0e733a%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/d1ac20e5-9198-47d1-91c4-cf6d6b0e733a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CABu8xFC0kWY2ncPW0tm5MbyMj8WFa%2BD2v6bBamdB-1fyk7qu5A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
