Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/Ratio/Enum_Ratio.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module Ratio where
--module Ratio(Enum(..)) where

import DRatio
import Ord_Ratio
import Real_Ratio
import RealFrac_Ratio

instance  (Integral a) => Enum (Ratio a) where
	succ n = (n+1)
	pred n = (n-1)
        toEnum n = fromInteger (toInteger n) :% 1
	fromEnum = fromInteger . truncate        -- may overflow
	enumFrom x = numericEnumFrom x
	enumFromTo x y = numericEnumFromTo x y
	enumFromThen x y = numericEnumFromThen x y
	enumFromThenTo x y z = numericEnumFromThenTo x y z


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.