[Haskell-beginners] print []
AntC
anthony_clayden at clear.net.nz
Tue Aug 27 11:46:59 CEST 2013
> Lukas Lehner <lehner.lukas <at> gmail.com> writes:
>
> ... My question is that I have to enforce the type that specific way
(don't want to use ExtendedDefaultRules) or is there some more generic way?
>
print flatten (List ([] :: Show a => [a])
Even for an empty list, we have to provide evidence that the list is
showable. That's what the type signature is doing: I am a list of
something/anything showable.
(If you want all of your NestedLists's to be showable, it's better to put
a Show constraint on the data decl. But that would take us into
existential types or GADT's.)
AntC
More information about the Beginners
mailing list