[WIP] Tree decl #22
[WIP] Tree decl #22
Conversation
…declaration-type Conflicts: Text/Documentalist/SourceParser/Clang.hs
I've got to rebase onto the new HEAD. |
-- | forall . k | ||
data Declaration :: * -> * where | ||
DecNode :: k -> Identifier -> DecFNode -> [Declaration k] -> Declaration k | ||
DecLeaf :: k -> Identifier -> DecFLeaf -> Declaration k |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what you mean by:
It is expressible as not a GADT, but it is misleading what the forall is, so I don't write them that way
oh and originally it was any type of content, so it was existensial, so it was a GADT. But restricting it is better
I like the GADT syntax, but I'm not sure how k
is restricted at all here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah what I meant was, originally, the DecFNode and DecFLeaf were both free in the for all, and their type didn't appear in the kind signature. But because we know something about the structure of it, we can have those 2 types set.
On 25/08/2013, at 4:33 AM, Justin Spahr-Summers notifications@github.com wrote:
In Text/Documentalist/SourceParser.hs:
-data Declaration = Class Identifier SuperTypes [Declaration] -- ^ A class declaration.
| Interface Identifier SuperTypes [Declaration] -- ^ An abstract interface, or Objective-C protocol definition.
| Mixin Identifier Type [Declaration] -- ^ A mixin, or Objective-C category declaration.
| Property Identifier UnderlyingType -- ^ A property declaration in a class.
| Enumeration Identifier UnderlyingType [Declaration] -- ^ An enumeration.
| Constant Identifier UnderlyingType -- ^ A constant within an enumeration or class, or outside of any scope.
| Function Identifier ResultTypes [Declaration] -- ^ A function.
| ClassMethod Identifier ResultTypes [Declaration] -- ^ A class method or static member function.
| InstanceMethod Identifier ResultTypes [Declaration] -- ^ An instance method or member function.
| Parameter Identifier UnderlyingType -- ^ The parameter to a function or method.
| TypeAlias Identifier Type -- ^ A redeclaration of a type under a different name.
+-- | forall . kderiving (Eq, Ord, Show)
+data Declaration :: * -> * where- DecNode :: k -> Identifier -> DecFNode -> [Declaration k] -> Declaration k
- DecLeaf :: k -> Identifier -> DecFLeaf -> Declaration k
Could you explain what you mean by:It is expressible as not a GADT, but it is misleading what the forall is, so I don't write them that way
oh and originally it was any type of content, so it was existensial, so it was a GADT. But restricting it is better
I like the GADT syntax, but I'm not sure how k is restricted at all here.
�
Reply to this email directly or view it on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k is a forall, any type of Comment can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@maxpow4h By the way, I'd prefer merging over rebasing for published branches. It's easy to see conflict resolution that way, and it doesn't break anyone's checked-out copies of the branch. |
Sure thing. |
This branch is going away now. |
Don't bother examining the details.
But the idea is:
Then in Clang.hs instead of
You can do
But if you used a
Class
instead of aTypeAlias
it would be a TYPE ERROR™ (Because aClass
can not be a leaf, it has contents inside of it).MAGIC