class Nest a where {depth :: Num b => a -> b}
instance Nest a => Nest [a] where {depth [] = 1; depth (x:_) = 1 + depth x}
instance Nest () where {depth _ = 0}
main = print $ depth [[()]]

これは再帰じゃなくてオーバーロードだから