blob: 152836d2707e0bd53a583e5ec5442add220d5d13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
{-# LANGUAGE FlexibleInstances, TypeFamilies #-}
import Data.Kind (Type)
class MyShow a where
myshow :: a -> String
instance MyShow a => MyShow [a] where
myshow xs = concatMap myshow xs
data T = MkT
instance MyShow T where
myshow x = "Used generic instance"
instance MyShow [T] where
myshow xs = "Used more specific instance"
type family F a :: Type
type instance F [a] = a -> F a
type instance F Int = Bool
|