Commit 483ff505 authored by Joachim Breitner's avatar Joachim Breitner
Browse files

Add examples from #8541 to testsuite

parent 79034762
......@@ -11,6 +11,10 @@ newtype Baz = Baz Bar deriving Show
type role Map nominal representational
data Map a b = Map a b deriving Show
-- Higher kinded coercions (#8541)
newtype List a = List [a] deriving Show
data T f = T (f Int)
main = do
print (coerce $ one :: Age)
print (coerce $ Age 1 :: Int)
......@@ -25,7 +29,13 @@ main = do
print (coerce $ Just one :: First Int)
print (coerce $ (mempty :: Last Age) :: Last Int)
printT (coerce $ (T (Left (Age 1)) :: T (Either Age)) :: T (Either Int))
printT (coerce $ (T (Left one) :: T (Either Int)) :: T (Either Age))
printT (coerce $ (T [one] :: T []) :: T List)
printT (coerce $ (T (List [one]) :: T List) :: T [])
where one = 1 :: Int
printT (T x) = print x
......@@ -7,3 +7,7 @@ Foo (Age 1)
Map 1 (Age 1)
First {getFirst = Just 1}
Last {getLast = Nothing}
Left 1
Left (Age 1)
List [1]
[1]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment