summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.hs
blob: 192dfbc8e163a0665950dcfa1218667601be4be2 (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 where
  MkFoo :: a -> (a -> String) -> Foo a

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

main = do
  print (foo (MkFoo ("hello", "goodbye") (\(x,y) -> reverse y ++ reverse x)))