Dec 2001 Hugs balks at the following simple program, while ghc 5.02.1 likes it just fine.

 

    module Tst where

    t1 :: (Num a) => Int -> ((?z :: Int) => a) -> a

    t1 w imp = imp with ?z = w

 

The Hugs error message:

 

    ERROR "f:/Shader/tst.hs":3 - Inferred type is not general enough

    *** Expression    : t1

    *** Expected type : Num a => Int -> ((?z :: Int) => a) -> a

    *** Inferred type : Num Int => Int -> ((?z :: Int) => a) -> Int

 

I can eliminate the error message by making the function be monomorphic or by eliminating the first argument and using a numeric literal, i.e., hugs likes the following just fine:

 

    t2 :: Int -> ((?z :: Int) => String) -> String

    t2 w imp = imp with ?z = w

 

    t3 :: (Num a) => ((?z :: Int) => a) -> a

    t3 imp = imp with ?z = 3

 

    - Conal

 

Reply via email to