-----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]      allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
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
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to