Partial type sigs
Simon Peyton Jones
simonpj at microsoft.com
Fri Feb 6 10:28:58 UTC 2015
| avoid breaking existing programs. We might as well make named
| wildcards lexically scoped by default, not even opt-out (as was the
| case in my initial proposal).
I don't object strongly, so long as the user manual is very clear on the question, and mentions the inconsistency with ordinary type variables.
| About using a Maybe for sig_id to fix 10045: I tried it out, and your
| solution does indeed fix it. In order for TcSigInfo to still implement
| NamedThing, I used an 'Either Name TcId' instead of a 'Maybe TcId'. Do
| you prefer a separate data type for this instead of an Either? (Please
| come up with a good name for it in that case :)
Better:
* Remove instance NamedThing TcSigInfo
* Add a field sig_name :: Name, and use it instead of getName in tcTySigs
Comment that if sig_id = Just f, then sig_name = idName f
* Leave the sig_id field as (Maybe TcId). It needs a pretty big comment.
Actually sig_poly_id would be a better name for the field.
| Unfortunately, some of my tests started failing, so I'll post
| something on Phabricator as soon as I have worked out the kinks.
OK thank you. Ping me when ready
Simon
|
|
| Cheers,
| Thomas
|
|
|
| > Sorry to make such a misleading post.
| >
| > Simon
| >
| > | -----Original Message-----
| > | From: dominique.devriese at gmail.com
| > [mailto:dominique.devriese at gmail.com]
| > | On Behalf Of Dominique Devriese
| > | Sent: 05 February 2015 20:13
| > | To: Simon Peyton Jones
| > | Cc: Thomas Winant; ghc-devs at haskell.org; Frank Piessens
| > | Subject: Re: Partial type sigs
| > |
| > | Simon,
| > |
| > | 2015-02-05 17:44 GMT+01:00 Simon Peyton Jones
| > <simonpj at microsoft.com>:
| > | > 3. It interferes with generalisation.
| > | >
| > | > For (3), consider
| > | >
| > | > let f :: _a -> _a
| > | >
| > | > f xs = reverse xs
| > | >
| > | > in (f True, f ‘x’)
| > | >
| > | > Here, f gets the type f :: forall b. [b] -> [b], and _a is
| unifed
| > with
| > | [b].
| > | >
| > | > So it simply doesn’t make sense for _a to appear in the body.
| > | > What
| > | would it
| > | > mean to say
| > | >
| > | > let f :: _a -> _a
| > | >
| > | > f xs = reverse xs
| > | >
| > | > in (f (True :: _a), f ‘x’)
| > |
| > | Isn't this a different case than Thomas' example? As I understand
| > | it, an equivalent of his example would have the wildcard in scope
| in
| > | the body of f, not in the body of the let. Something like this:
| > |
| > | let f :: _a -> _a
| > | f xs = reverse (xs :: _a)
| > | in (f [True], f "x")
| > |
| > | or
| > |
| > | let f :: _a -> _a
| > | f xs = let ys :: _a
| > | ys = tail xs
| > | in reverse ys
| > | in (f [True], f "x")
| > |
| > | I agree with what you say about _a being in scope in the body of
| the
| > | if, but I don't see a problem with _a being in scope in the body
| of
| > f.
| > | Do you?
| > |
| > | Note also that I haven't yet checked which of both is actually
| > | implemented.
| > |
| > | Regards,
| > | Dominique
|
| Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the ghc-devs
mailing list