Hi Brandon, True, when I replace [] with [""], I get a different error message:
No instance for (PolyVariadic [[Char]] (WMonoid String)) which now looks a bit like the Int example. In both cases, GHC appears to be unable to derive the appropriate instance of PolyVariadic. Why this is so, but worked for Oleg's specific example. is still not clear to me. Kevin On Oct 9, 11:51 pm, Brandon S Allbery KF8NH <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 10/9/10 10:25 , Kevin Jardine wrote: > > > instance Show a => Monoidable a [String] where > > toMonoid a = [show a] > > > main = putStrLn $ unwrap $ polyToMonoid [] True () (Just (5::Int)) > > > fails to compile. > > > Why would that be? My understanding is that all lists are > > automatically monoids. > > I *think* the problem here is that Oleg specifically pointed out that the > first parameter to polyToMonoid must specify the type of the monoid. [] > tells you it's a list, therefore a monoid, but it doesn't say enough to > allow the [String] instance to be chosen. (No, the fact that you only > declared an instance for [String] isn't really enough.) > > - -- > brandon s. allbery [linux,solaris,freebsd,perl] [email protected] > system administrator [openafs,heimdal,too many hats] [email protected] > electrical and computer engineering, carnegie mellon university KF8NH > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.10 (Darwin) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAkyw49wACgkQIn7hlCsL25VZygCfVETk+3AZ3gKoBy4pZ7j8g4Km > WXgAnjrbO9rEl2HnQtGQ31EyRuhWzI4r > =YMDw > -----END PGP SIGNATURE----- > _______________________________________________ > Haskell-Cafe mailing list > [email protected]http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
