Michael Snoyman wrote:
Note that I wasn't necessarily advocating such a pragma. And a lot of
my XML code actually *does* use two IsString instances at the same
time, e.g.:
Element ("img" :: Name) (singleton ("href" :: Name) ("foo.png" ::
Text)) [NodeComment ("No content inside an image" :: Text)]
In this particular case, would it make sense to use smart constructors
instead?
The idea is that you can put the polymorphism in two places: either make
the "output" polymorphic, or make the "input" polymorphic. The latter
would correspond to a type
element :: (IsString name, IsString s, IsMap map)
=> name -> map name s -> [Element]
element name map = Element (toName name) (toMap map)
One benefit would be that the function will accept any list as a map,
not just list literals.
Best regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe