Can someone explain type unification in Haskell? For example: snd . snd :: (a1, (a2, c)) -> c
How do we get to, (a1, (a2, c)) -> c
, from snd . snd
?
Thanks in advance for the help.
Can someone explain type unification in Haskell? For example: snd . snd :: (a1, (a2, c)) -> c
How do we get to, (a1, (a2, c)) -> c
, from snd . snd
?
Thanks in advance for the help.
Start with
Applying
(.)
tosnd
, with the following pairingsyields
Now applying this to
snd
again with the following pairingsyields
This obscures where
y1
comes from. But since~
is symmetric, we can replacey2
with(x1, y1)
to yieldwhich is equivalent to
(a1, (a2, c)) -> c
up to alpha renaming.