X-Comment1: #############################################################
X-Comment2: # uk.ac.glasgow.cs has changed to uk.ac.glasgow.dcs #
X-Comment3: # If this address does not work please ask your mail #
X-Comment4: # administrator to update your NRS & mailer tables. #
X-Comment5: #############################################################
Mark Lillibridge points out that the report does not make explicit
that all predicated types in typing judgements must have contexts
which constrain only type variables. Thus,
f :: (Eq a) => [a] -> a -> Bool
is ok, but
f :: (Eq [a]) => [a] -> a -> Bool
is NOT ok. This is an important omission; thanks to Mark for pointing
it out [I know it is not for the first time, either].
As you know I'm trying to get the report done for Sigplan Notices. So I'm
keen to add something modest to help with this problem. So I propose the
following new text for the end of Section 4.5.2, which concerns
generalisation (page 37).
Can you type heros say if you think this would help, and/or suggest a better
version? Thanks
Simon
Add to the end of para 2 of 4.1.3 the following
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Furthermore, the context c must be of the form given above in
4.1.2; in particular, it may constrain only type variables.
Add to 4.5.2 the following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
As mentioned in 4.1.3, the context of a type may constrain
only type variables. Consider, for example, the definition
f xs y = [x] == ys
Its type is given by
f :: Eq a => [a] -> a -> Bool
and not
f :: Eq [a] => [a] -> a -> Bool
Even though the equality is taken at the list type, the
context must be simplified, using instance declaration for @Eq@ on
lists, before generalisation. If no such instance is in scope,
an error is signalled.