summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/TyAppPat_ScopedTyVarConflict.hs
blob: 6906ed627b2dad7c2148a9e0d1251aa100e01053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Main where

-- Shouldn't work because we don't accept multiple occurrences of a binding variable.
foo :: forall a. Monoid a => Maybe a -> a
foo (Nothing @a) = (mempty :: a)
foo (Just @a x) = (x :: a)

main = do
  print (foo @String Nothing)