[Haskell-cafe] About 'Overloaded functions are not your friend' line in GHC manual

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Fri Jan 11 18:58:37 UTC 2019


On 11.01.19 19:13, Brandon Allbery wrote:

> Only up to a point. Recursive uses — such as show, which delegates to
> other Show instances for record fields, etc. — are problematic.

Please explain. Do you mean that

size   (S (S Z))   and    size_N (S (S Z))

are not equivalent for these declarations?

class Size t where size :: t -> Int

data N = Z | S N

instance Size N where  size Z = 0 ; size (S n) = succ (size n)

size_N Z = 0 ; size_N (S n) = succ (size n)

I was trying to read core for this but I'm not sure
what's the best way to call  ghc.
Which of the  -ddump-*  options is best suited (-ddump-simpl ?)
and what do I look for in the output?

Thanks - J.W.


More information about the Haskell-Cafe mailing list