# E4118

Cannot match type with map pattern.

You can use map patterns on custom types, as long as they have a method `get`
that returns an optional value for a given key.

## Erroneous example

```{literalinclude} /sources/error_codes/4118_error/top.mbt
:language: moonbit
```

## Suggestion

Implement the `get` method as suggested in the error message.

```{literalinclude} /sources/error_codes/4118_fixed/top.mbt
:language: moonbit
```
