Lenart was right.
I am sorry, indeed,   toZ :: Integral a => a -> Z
                      toZ = toInteger  
helps. I recalled, exactly this was the initial bug program.
But sorry, probably, i had confused something.


Still, why moving   toZ = toInteger  :: Integral a => a -> Z

to another module (Main.hs) changes the compilation success?


-----------------------------------------------------
module T1 where
type Z = Integer
toZ    = toInteger  :: Integral a => a -> Z   
-----------------------------------------------------
module Main where
import List (genericTake)
import T1   (Z, toZ     )
f :: Z -> Z -> [Z] 
f    n    i =  case  toZ i  of  j -> genericTake (n+j) (repeat n)

main = let  ns = f 2 3  in   putStr (shows ns "\n")
-----------------------------------------------------------------



Also i used to read "probably...monomorphism restriction..." in ghc 
report, and then to impove the code. This time, the report is not so
easy to understand:
    Couldn't match `Int' against `Z'
        Expected type: Int
        Inferred type: Z
    In the first argument of `toZ', namely `i'
    In the scrutinee of a case expression: toZ i



------------------
Sergey Mechveliani
[EMAIL PROTECTED]





Reply via email to