summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.hs
blob: bba6d08a11289e0c6f8ed12e8510fc99af9a516b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# 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 :: Maybe String -> Maybe String -> String
foo (Nothing @a) (Nothing @a) = ("" :: a)
foo (Just @a x) (Nothing @a) = (x :: a)
foo (Nothing @a) (Just @a y) = (y :: a)
foo (Just @a x) (Just @a y) = (x ++ y :: a)

main = do
  print (foo Nothing (Just "hello"))