[Haskell-beginners] print []

David Virebayre dav.vire+haskell at gmail.com
Wed Aug 14 12:08:39 CEST 2013


2013/8/13 Lukas Lehner <lehner.lukas at gmail.com>:
> Good to know extension. And without it?

Someone correct me if I'm wrong, here's how I understand it:

To execute print [], ghc has to find which instance of Show to call.
How could it find an instance without knowing the type ?
[] could be a list of anything, and while in theory we know that in
all cases it should print "[]", in practice ghc can't call that code
if it doesn't know the type of the list.

David.




More information about the Beginners mailing list