| Subject: Type signatures in instance declarations?
|
| > Why are these illegal? I appreciate that they can't
| give useful information
| > to the compiler, which knows the type already from the
| class, but in my
| > opinion they are still useful to the maintainer,
| because they serve as
| > a reminder of the type.
|
| I think it would be even useful to the compiler when one has a
| polymorphic recursion. ISTR occasions when I wasn't able to define
| fmap directly (eg. for a nested datatype for lambda calculus terms),
| but had to define another name for it with a polymorphic declaration,
| then equate fmap to it in the instance declaration.
Interesting: so you wanted to write a type signature that was *more general*
than the one for the instance decl? Right? Whereas Koen asks
| * Why can one not have a type declaration of a function
| twice ore more in a file? It seems a bit silly, because
| you are allowed to put the type declaration of a
| function any place you want, but you cannot copy it.
Presumably the function would be given the more specific of the two types?
Which isn't what Peter wants for instance decls.
| * Why can one not have a type declarion in the export
| list of a module? Common practice for many people
| is to put these types in comments now (which is really
| dangerous, since the types might change but not the
| comments).
What about type and class decls? Wouldn't it be nice if a module export
list constituted its signature? We considered this at various stages in the
Haskell design, but no one came up with a complete design that 'fitted'.
Generic issue: These are all good suggestions but they all
need to be designed
increase incompatibility between Haskell impls (unless all march on
together),
increase the complextity of the language (a little)
That hasn't stopped us lobbing lots of things in, but they have generally
been things that let you do things that were simply impossible before.
Features that make programming easier but don't increase power don't seem
to be used. Example: pattern guards, which GHC has supported for a couple of
years, but no one uses. Why? Because only GHC supports them.
Simon