summaryrefslogtreecommitdiff
path: root/testsuite/tests/wcompat-warnings/WCompatWarningsOff.hs
blob: 33c26ccbc14bd2c6bab3a0ad72b6c9a97f7770a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Test purpose:
-- Ensure that using -Wno-compat does not switch on warnings
{-# LANGUAGE NoMonadFailDesugaring #-}
-- {-# OPTIONS_GHC -Wcompat #-}
{-# OPTIONS_GHC -Wno-compat #-}

module WCompatWarningsOff where

import qualified Data.Semigroup as Semi

monadFail :: Monad m => m a
monadFail = do
    Just _ <- undefined
    undefined

(<>) = undefined -- Semigroup warnings

-- -fwarn-noncanonical-monoid-instances
newtype S = S Int

instance Semi.Semigroup S where
  (<>) = mappend

instance Monoid S where
  S a `mappend` S b = S (a+b)
  mempty = S 0