... | ... | @@ -25,7 +25,34 @@ Having source file delimeted by pragmas is not good idea as for me, because it w |
|
|
|
|
|
It is not very easy to form a good use case for this but nevertheless.
|
|
|
|
|
|
1. For example, if you depend on particular library function(if you want to support backward compatability) but in newer version of library this function marked as deprecated and so you get warnings about it. Here it may be useful to suppress them instead of rewriting the whole codebase. I have asked about use cases on [ Haskell's reddit cahnnel](https://www.reddit.com/r/haskell/comments/3rbpb6/examples_of_warnings_in_haskell/)
|
|
|
1. For example, if you depend on particular library function(if you want to support backward compatability) but in newer version of library this function marked as deprecated and so you get warnings about it. Here it may be useful to suppress them instead of rewriting the whole codebase. I have asked about particular use cases on [ Haskell's reddit cahnnel](https://www.reddit.com/r/haskell/comments/3rbpb6/examples_of_warnings_in_haskell/) and some people need to support old libraries. For example `CRandT` in `monadcryptorandom-0.6.1`:
|
|
|
|
|
|
|
|
|
Many instances, e.g. `MonadTrans` have `Error e` constraint, which is deprecated in the newer `transformers`.
|
|
|
In `monadcryptorandom-0.7.0``CRandT` is implemented using `ExceptT` so constraint is gone.
|
|
|
|
|
|
|
|
|
To be more precise, here is the code example
|
|
|
|
|
|
```
|
|
|
instanceMonoidDivByErrorwhere
|
|
|
mempty =Other"guard error"
|
|
|
```
|
|
|
|
|
|
```
|
|
|
Prelude> :r
|
|
|
[1 of 1] Compiling Fp11WithExcept ( fp11WithExcept.hs, interpreted )
|
|
|
|
|
|
fp11WithExcept.hs:123:10: Warning:
|
|
|
No explicit implementation for`mappend'
|
|
|
In the instance declaration for `Monoid DivByError'
|
|
|
Ok, modules loaded: Fp11WithExcept.
|
|
|
```
|
|
|
|
|
|
|
|
|
So here we are getting a warning that we want so suppress. This example is given by my lecturer. Here we replacing `ErrorT` transformer for `ExceptT`.
|
|
|
|
|
|
|
|
|
1. Recent monad of no return proposal suggests that having `Applicative` context sufficed for `Monad` assumes that `return` is already implemented as `pure`, so we don't need to duplicate code. However, Monad still has minimal complete definition `>>=` and `return`, so we can have warnings about incomplete minimal definition.
|
|
|
|
|
|
## Exempli gratia
|
... | ... | |