blob: 8c50ec96c407a4061190e98aeed1b2a08613709e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
data Foo b where
MkFoo :: forall b a. a -> (b -> a -> String) -> Foo b
foo :: Foo b -> b -> String
foo (MkFoo @b @a x f) u = f (u :: b) (x :: a)
main = do
print (foo (MkFoo "hello" (\x y -> reverse y ++ show x)) (6 :: Integer))
|