blob: c2c2e32b691a306285f20584587ce7ffbfa7e9f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
{-# LANGUAGE Haskell2010 #-}
{-# 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
|