Add GHCi :instances command
[ghc.git] / testsuite / tests / ghci / scripts / ghci064.hs
1 {-# LANGUAGE FlexibleInstances, TypeFamilies #-}
2 import Data.Kind (Type)
3
4 class MyShow a where
5 myshow :: a -> String
6
7 instance MyShow a => MyShow [a] where
8 myshow xs = concatMap myshow xs
9
10 data T = MkT
11
12 instance MyShow T where
13 myshow x = "Used generic instance"
14
15 instance MyShow [T] where
16 myshow xs = "Used more specific instance"
17
18
19 type family F a :: Type
20 type instance F [a] = a -> F a
21 type instance F Int = Bool