Upcoming SlideShare
×

593 views
402 views

Published on

Created in 8 Sep. 2008

2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
593
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
0
0
Likes
2
Embeds 0
No embeds

No notes for slide

2. 2. Basic NumberType Precision Instance Data Structure Single- Integral, Int minBound ... -1 | 0 | 1 ... maxBound Precision Bounded Arbitrary-Integer Integral ... -1 | 0 | 1 ... Precision Single- Float RealFloat - Precision Double-Double RealFloat - Precision
3. 3. More Number Type Precision Instance Data Structure Ratio (Integral a) => Ratio a = !a :% !a - RealFrac(Rational) Rational = Ratio IntegerComplex - Floating (RealFloat a) => Complex a = !a :+ !a
4. 4. Type : IntegerShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
5. 5. Type : IntShow Num Fractional Floating Eq RealFloat Real RealFracOrd Integral BoundedEnum
6. 6. Type : RationalShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
7. 7. Type : ComplexShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
8. 8. Type : Float & DoubleShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
9. 9. Casting FunctionsfromInteger (Num a) => Integer -> a toInteger (Integral a) => a -> IntegerfromRational (Fractional a) => Rational -> a toRational (RealFrac a) => a -> Rational (Integral a, Num b) => a -> bfromIntegral fromInteger . toIntegerfromRealFrac (RealFrac a, Fractional b) => a -> b (realToFrac) fromRational . toRational
10. 10. Using NumberFocus on properties Class providedFocus on a particular type
11. 11. Using NumberFocus on properties Class providedfunc :: (Fractional α) => α -> αFocus on a particular typefunc :: Double -> Double
12. 12. Using NumberFocus on properties Class providedfunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on a particular typefunc :: Double -> Double - Can be Double only
13. 13. Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on what Double can dofunc :: Double -> Double - Can be Double only
14. 14. Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on what Double can dofunc :: Double -> Double - Can be Double only
15. 15. Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on what Double can dofunc :: Double -> Double - Can be Double only
16. 16. THX.