[Hugs-bugs] monomorphism bug
I can't track this one down, so I'll post it: Prelude> :t let f = const 1 in let g = f in g let {...} in (let {...} in g) :: Num a => b -> c The error here is that a and c should be identified. In larger examples, this can cause real trouble. More detail: f is subject to the Monomorphism Restriction, so its return type should be monomorphic. Hugs gets this right, as seen in Prelude> :t let f = const 1 in (f,f) let {...} in (f,f) :: Num a => (b -> a,c -> a) However it loses the constraint on the type of g, as seen in Prelude> :t let f = const 1 in let g :: a -> b; g = f in g let {...} in (let {...} in g) :: Num a => b -> c (which it should reject). It seems essential that the type of f contain fully polymorphic variables as well as the constrained one.
participants (1)
-
Ross Paterson