Skip to content

Instantly share code, notes, and snippets.

@klaaz0r
Created September 19, 2017 13:15
Show Gist options
  • Save klaaz0r/dab6717922d7595ae22e960fcc7460c8 to your computer and use it in GitHub Desktop.
Save klaaz0r/dab6717922d7595ae22e960fcc7460c8 to your computer and use it in GitHub Desktop.
manual type inference
foldr . map
(. map) foldr
(.) :: (b1 -> c1) -> (a1 -> b1) -> a1 -> c1
map :: (a2 −> b2) −> [a2] −> [b2]
foldr :: (a3 -> b3 -> b3) -> b3 -> [a3] -> b3
(b1 -> c1) ~ (a2 −> b2) −> [a2] −> [b2]
b1 = (a2 −> b2)
c1 = [a2] −> [b2]
(a1 -> b1) ~ (a3 -> b3 -> b3) -> b3 -> [a3] -> b3
a1 = (a3 -> b3 -> b3)
b1 = b3 -> [a3] -> b3
a2 = b3
b2 = [a3] -> b3
a1 -> c1
(a3 -> b3 -> b3) -> [b3] −> [[a3] -> b3]
(a -> b -> b) -> [b] −> [[a] -> b]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment