Open
Conversation
- these don't need a bare List instance - can describe nodes whose subtrees have existential type
- add some documentation - cleanups
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request establishes a third way of describing node constructors for
gdiff. The newMetaconstructor subsumes the functionality ofAbstrbut is a bit less efficient. The usage recipe is{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-} data Hidden = forall t . Type Fam t => Hide t data Fam ft ts where Hidden' :: List Fam ts => Fam t ts -> Fam Hidden ts -- ... instance Family Fam where instance Type Fam Hidden where constructors = [Meta $ \(Hide (a :: t)) -> head $ [ Concr (Hidden' con) | Concr con :: Con Fam t <- constructors , Just _ <- [fields con a] ] ]With
Abstrits is impossible to define a function of typeHidden -> Fam Hidden (Cons a Nil)since it would expose a (skolem constant) unknown existential type. However it is entirely possible to write a function of typeHidden -> Con Fam Hiddenas requested by the newMetaway.