As a beginner I want to implement such fuction:

plusSecs :: Num a => a -> ClockTime -> ClockTime
plusSecs n = addToClockTime ( secTimeDiff (n) )
            where secTimeDiff n = TimeDiff { tdYear = 0,
                                             tdMonth = 0,
                                             tdDay = 0,
                                             tdHour = 0,
                                             tdMin = 0,
                                             tdSec = n,
                                             tdPicosec = 0 }

The problem here that it's type signature is illegal because tdSec of
System.Time.TimeDeff must be Int type only, but I wish to apply
plusSecs to any Num or (at least) any Integral type number. The reason
for this - to have less compilation errors (that are mostly about
error types) and more abstractedness (generality) of this function.

So, the question is: Is it possible somehow to convert any Num (or at
least Integral) to Int.
Please, tell me if I don't get smth in Haskell type system.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to