Skip to content

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.

ggreif added 2 commits March 12, 2015 10:47
 - 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