Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Doug McIlroy <doug <at> cs.dartmouth.edu>
Subject: type inference & instance extensions
Newsgroups: gmane.comp.lang.haskell.general
Date: Monday 19th January 2009 13:36:54 UTC (over 8 years ago)
A fragment of an attempt to make pairs serve as complex numbers,
using ghc/hugs extensions:

        instance Num a => Num (a,a) where
                (x,y) * (u,v) = (x*u-y*v, x*v+y*u)

Unfortunately, type inference isn't strong enough to cope with

        (1,1)*(1,1)

Why shouldn't it be strengthened to do so?
Or is there a declarative trick (perhaps with dependent
classes) that will accomplish the goal?

Doug McIlroy
 
CD: 3ms