[Haskell-beginners] Fractional Int

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Fri Mar 20 19:37:32 EDT 2009


On 2009 Mar 20, at 18:01, Sean Bartell wrote:
> For a type "a" to be Fractional requires there to be:
> (/) :: a -> a -> a
> You can't divide an Int by another Int and (in general) get a third
> Int. You would probably want something like a "Fractionable"
> typeclass, with
> (/) :: a -> a -> b
> which would result in a Rational, but Haskell doesn't have this.


...but there is (%) :: (Integral a) => a -> a -> Ratio a

-- 
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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20090320/82dd6ffd/PGP.bin


More information about the Beginners mailing list