Keith, thank you for your hint to use asTypeOf procedure.
It is a nice way to do it with existing features of Haskell98.
Also, specifying the type on left-hand side, which can be done in Hugs,
can also help sometimes. I think that it is possible to implement a more
general mechanism for influencing type inference, although I am not sure
that it is really needed so often. In order to constrain the types of several
subexpressions we could use "let" declaration

>  let (e1', e2', e3') = specTypes (e1, e2, e3)
>  in ... e1' ... e2'... e3'....

with (say):

>specTypes :: (Either a b, (a,b), [b]) -> (Either a b, (a,b), [b])
>specTypes = id

If the compiler removes application of specTypes in code generation, the only
effect is type specialization.


As for liftings, it is not quite clear to me what the practical
advantages of using natural liftings instead of arbitrary ones are. 
Is it easier to lift axioms for semantic blocks if the lifting of operations are
natural?

Viktor


Reply via email to