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!
@jump_spider there is less esoteric but more obvious way to do that.
```elixir
%{__struct__: module} = foo
```
@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: …