News for hackers. Stuff that matters.
Re:Implementing and Understanding Type Classes (2014) by tome on Sunday April 29, 2018 @03:12AM (#16951025)
> Polymorphic recursion does allow some cool things such as arbitrarily nested lists. This is a feature that users from a dynamically typed language might miss.

What do you mean? You can implement arbitrarily nested lists (rose trees) in Haskell.

Re:Implementing and Understanding Type Classes (2014) by g___ on Sunday April 29, 2018 @09:09AM (#16951843)
Right, you can have rose trees without polymorphic recursion:

data Tree1 a = Leaf1 a | Node1 [Tree1 a]

flatten :: Tree1 -> [a]

But this type needs it:

data Tree2 a = Leaf2 a | Node2 (Tree2 [a])

flatten2 :: Tree2 -> [a]

Tree1 can vary in depth between nodes, while Tree2 is either a, [a], [[a]], [[[a]]] etc.

Re:Implementing and Understanding Type Classes (2014) by tome on Sunday April 29, 2018 @12:39PM (#16952711)
I agree, but you can't have the latter in a dynamic language anyway so I don't see why calebh said dynamic language users would miss it.