Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existentials #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Existentials #8

wants to merge 2 commits into from

Conversation

ggreif
Copy link
Contributor

@ggreif ggreif commented Mar 12, 2015

This pull request establishes a third way of describing node constructors for gdiff. The new Meta constructor subsumes the functionality of Abstr but 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 Abstr its is impossible to define a function of type Hidden -> 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 type Hidden -> Con Fam Hidden as requested by the new Meta way.

 - these don't need a bare List instance
 - can describe nodes whose subtrees have existential type
 - add some documentation
 - cleanups
@ggreif
Copy link
Contributor Author

ggreif commented Mar 19, 2015

@eelco @kosmikus Any chance to conduct a quick review on these PRs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant