TIL you can pattern match the module of an unknown struct in #Elixir with
%module{} = foo
This is incredible!
Discussion
TIL you can pattern match the module of an unknown struct in #Elixir with
%module{} = foo
This is incredible!
@tylerayoung Very nice! I fall more and more in love with this language as I learn more about it.
@jump_spider It’s so good! 😄 I find myself using it in function heads a lot, like:
def foo(%struct{}) when struct in [MyApp.Foo, MyApp.Bar], do: …