I have the following snippet with full type annotation.

```
type context = string
type result<'a> =
| Ok({parsed: 'a, newContext: context})
| Err(string)
let map = (r: result<'a>, fn: 'a => 'b): result<'b> =>
switch r {
| Ok({parsed, newContext}) => Ok({parsed: fn(parsed), newContext: newContext})
| e => e
}
let flatMap = (r: result<'a>, fn: ('a, context) => result<'b>): result<'b> =>
switch r {
| Ok({parsed, newContext}) => fn(parsed, newContext)
| e => e
}
```

I expect `map`

to have type `(result<'a>, 'a => 'b) => result<'b> `

and `flatMap`

to have type `(result<'a>, ('a, context) => result<'b>) => result<'b>`

. However, the compiler insists that `map`

has type `(result<'b>, 'b => 'b) => result<'b> `

and `flatMap`

has type `(result<'b>, ('b, context) => result<'b>) => result<'b>`

.

Could anyone please show me what I’m doing wrong here?