... | @@ -210,10 +210,11 @@ Both of those tell us the "real" desugaring as just another pattern we could rec |
... | @@ -210,10 +210,11 @@ Both of those tell us the "real" desugaring as just another pattern we could rec |
|
(>>=) = <...bind impl...>
|
|
(>>=) = <...bind impl...>
|
|
-- NB: `return` defaults to `pure` since GHC 7.10
|
|
-- NB: `return` defaults to `pure` since GHC 7.10
|
|
|
|
|
|
-- Monad(fail) will be removed in GHC 8.8+
|
|
-- Monad(fail) will be removed in GHC 8.8+;
|
|
|
|
-- GHC may or may not ignore a definition in terms of MonadFail(fail) (decision pending)
|
|
fail = Fail.fail
|
|
fail = Fail.fail
|
|
|
|
|
|
instance MonadFail Foo where
|
|
instance Fail.MonadFail Foo where
|
|
fail = <...fail implementation...>
|
|
fail = <...fail implementation...>
|
|
```
|
|
```
|
|
1. Change your pattern to be irrefutable
|
|
1. Change your pattern to be irrefutable
|
... | @@ -221,17 +222,17 @@ Both of those tell us the "real" desugaring as just another pattern we could rec |
... | @@ -221,17 +222,17 @@ Both of those tell us the "real" desugaring as just another pattern we could rec |
|
|
|
|
|
```
|
|
```
|
|
do Left e <- foobar
|
|
do Left e <- foobar
|
|
stuff
|
|
stuff
|
|
```
|
|
```
|
|
|
|
|
|
becomes
|
|
becomes
|
|
|
|
|
|
```
|
|
```
|
|
do x <- foobar
|
|
do x <- foobar
|
|
e <- case x of
|
|
e <- case x of
|
|
Left e' -> e'
|
|
Left e' -> e'
|
|
Right r -> error "Pattern match failed" -- Boooo
|
|
Right r -> error "Pattern match failed" -- Boooo
|
|
stuff
|
|
stuff
|
|
```
|
|
```
|
|
|
|
|
|
The point is you'll have to do your dirty laundry yourself now if you have a value that *you* know will always match, and if you don't handle the other patterns you'll get incompleteness warnings, and the compiler won't silently eat those for you.
|
|
The point is you'll have to do your dirty laundry yourself now if you have a value that *you* know will always match, and if you don't handle the other patterns you'll get incompleteness warnings, and the compiler won't silently eat those for you.
|
... | | ... | |