[Haskell-cafe] Extending the idea of a general Num to other types?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Wed Sep 5 07:07:11 EDT 2007

On Sep 5, 2007, at 6:47 , Ketil Malde wrote:
> On Wed, 2007-09-05 at 09:56 +0100, Simon Peyton-Jones wrote:
>> Good point.  Not so easy for multi-parameter type classes! E.g. No  
>> instance for (Bar String Int).  So we could have
>>         String is not an instance of class Foo  -- single param
>>         No instance for (Bar String Int)                -- multi- 
>> param
> If you quote things, you can also consider:
>  	   'String Int' is not an instance of class 'Bar'.
> Downside is that 'String Int' by itself may be confusingly  
> unhaskellish.

I'd phrase it instead as:

   Class "Num" has no instance for "String"
   Class "Num" has no instance for "Complex"
   Class "Bar" has no instance for "String" and "Int"
(or maybe ("String","Int") since it's conceptually similar to a  
tuple, and the formulation above could conceivably be misconstrued as  
looking for separate instances for String and Int?)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list