summaryrefslogtreecommitdiff
path: root/testsuite/tests/pmcheck/complete_sigs/T17149.hs
blob: ba68154f3c554a7d73f5060146105eb3f3d70f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# OPTIONS_GHC -Wincomplete-patterns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Bug where

class Member a b where
  prj :: b -> Maybe a

pattern P :: Member a b => a -> b
pattern P a <- (prj -> Just a)

{-# COMPLETE P :: Bool #-}

-- | Trying to instantiate P with 0 type arguments doesn't work, it takes 2.
-- This seemingly unrelated fact, only relevant through the COMPLETE set, may
-- not lead the compiler to crash or do shady stuff.
fun :: Bool -> ()
fun True = ()
fun _    = ()