Changes between Version 11 and Version 12 of Design/LocalWarningPragmas


Ignore:
Timestamp:
Dec 8, 2015 10:54:17 PM (4 years ago)
Author:
edgar.zhavoronkov
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Design/LocalWarningPragmas

    v11 v12  
    2020It is not very easy to form a good use case for this but nevertheless.
    2121
    22 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 [https://www.reddit.com/r/haskell/comments/3rbpb6/examples_of_warnings_in_haskell/ Haskell's reddit cahnnel] 
     221. 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 [https://www.reddit.com/r/haskell/comments/3rbpb6/examples_of_warnings_in_haskell/ Haskell's reddit cahnnel] and some people need to support old libraries. For example `CRandT` in `monadcryptorandom-0.6.1`:
     23
     24Many instances, e.g. `MonadTrans` have `Error e` constraint, which is deprecated in the newer `transformers`.
     25In `monadcryptorandom-0.7.0` `CRandT` is implemented using `ExceptT` so constraint is gone.
     26
     27To be more precise, here is the code example
     28
     29{{{#!hs
     30instance Monoid DivByError where
     31  mempty = Other "guard error"
     32}}}
     33{{{#!sh
     34Prelude> :r
     35[1 of 1] Compiling Fp11WithExcept   ( fp11WithExcept.hs, interpreted )
     36
     37fp11WithExcept.hs:123:10: Warning:
     38    No explicit implementation for
     39      `mappend'
     40    In the instance declaration for `Monoid DivByError'
     41Ok, modules loaded: Fp11WithExcept.
     42}}}
     43
     44So 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`.
     45 
    23462. 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.
    2447