summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.hs
blob: efdcf517f9e55d8b43217407e95398d2387124ec (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

data Foo a b where
  MkFoo :: a -> (a -> String) -> b -> Foo a b

-- Shouldn't work because we don't accept multiple occurrences of a binding variable.
foo :: Foo String String -> String
foo (MkFoo @a @a x f y) = f (x ++ y :: a)

main = do
  print (foo (MkFoo "hello" reverse "goodbye"))