Closed GoogleCodeExporter closed 9 years ago
this is not so easy:
* constructors can be given a type signature too
* type signatures can be specified for local functions (where f :: A -> B)
* type functions always have a type signature
that said, I am attaching a patch (for archival) but it is not functional yet.
The main problem is that the parser cannot transparently produce
many (Parser Dec) objects, but only some grouped Dec (as in the patch) or a
(Parser
[Dec]), which does not match with the rest and has similar problems.
Original comment by ggr...@gmail.com
on 11 Dec 2007 at 2:40
Attachments:
I think there is a real bug, though:
Index: Syntax.hs
===================================================================
--- Syntax.hs (revision 49)
+++ Syntax.hs (working copy)
@@ -244,7 +245,8 @@
isTypeSyn _ = False
isTypeFun (TypeFun _ _ _ _) = True
-isTypeFun (TypeSig loc (Global (x:xs)) pt) = True
+isTypeFun (TypeSig loc (Global (x:xs)) (Karrow' _ _)) | isLower x = True
+--isTypeFun (TypeSig loc (Global (x:xs)) pt) = True
isTypeFun _ = False
isTheorem (AddTheorem _ _ ) = True
isTypeFun should check for the Karrow, the isLower test is just paranoia.
Original comment by ggr...@gmail.com
on 11 Dec 2007 at 2:42
It is already possible to interleave type declarations and definitions, see:
http://code.google.com/p/omega/source/browse/trunk/tests/Unification.prg?spec=sv
n687&r=687#12
So there already must be a mechanism to store signatures which are added to a
scope.
That said, we could simply make a
data Dec = ...
| MultiTypeSig Loc [Var] PT
And later drop the "Multi"...
Original comment by ggr...@gmail.com
on 1 Feb 2011 at 11:36
r694-r697 fixes this. I succeeded along the lines of comment 3 :-)
TypeSigs with multiple variables are expanded out before digesting, so later we
only have to deal with singleton variable lists in TypeSigs.
Original comment by ggr...@gmail.com
on 2 Feb 2011 at 3:20
Original issue reported on code.google.com by
ggr...@gmail.com
on 11 Jul 2007 at 4:45