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

module Main where

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

foo :: Foo String -> String
foo (MkFoo @a (Nothing @b) f) = "nothing"
foo (MkFoo @a (Just @b x) f) = f ((x :: b) :: a)

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