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

Slightly tweak Rep and Fix for pedagogical reasons #44

Closed
arianvp opened this issue Mar 5, 2019 · 5 comments
Closed

Slightly tweak Rep and Fix for pedagogical reasons #44

arianvp opened this issue Mar 5, 2019 · 5 comments
Milestone

Comments

@arianvp
Copy link
Collaborator

arianvp commented Mar 5, 2019

If we shuffle around the arguments of Rep, it is clear it returns a Functor over Set^n

data RepF :: (kon -> *) -> [[[Atom kon]]] -> (Nat -> *) -> (Nat -> *) where
  RepF :: Rep ki phi (Lkup ix codes) -> RepF ki codes phi ix

then we can use a heterogenous Fix that doesnt mention generics-mrsop constructs at all.
I'm not sure if we actually want it in code, but it's at least a nice comment to show there's
a direct relationship with the Fix that most people already know.

data Fix :: ((Nat -> *) -> (Nat -> *)) -> (Nat -> *) where
  Fix :: f (Fix f) n -> Fix f n


a  ~  Fix (RepF (Code a))

vs

data Fix :: (* -> *) -> * where
  Fix :: f (Fix f) -> Fix f
@serras
Copy link
Collaborator

serras commented Mar 5, 2019

The Fix using Nat is nothing else that the one from multirec, but using the more modern DataKinds extension.

@arianvp
Copy link
Collaborator Author

arianvp commented Mar 5, 2019

Correct

@VictorCMiraldo
Copy link
Owner

VictorCMiraldo commented Mar 6, 2019 via email

@VictorCMiraldo
Copy link
Owner

@arianvp , I'm not sure I understand your proposal.

Currently, we have:

newtype Rep (ki :: kon -> *) (phi :: Nat -> *) (code :: [[Atom kon]])
  = Rep { unRep :: NS (PoA ki phi) code }

data AnnFix (ki :: kon -> *) (codes :: [[[Atom kon]]]) (phi :: Nat -> *) (n :: Nat) =
  AnnFix (phi n)
         (Rep ki (AnnFix ki codes phi) (Lkup n codes))

type Fix ki codes = AnnFix ki codes (Const ())

If I got it right, you are proposing we move to:

newtype Rep (ki :: kon -> *) (code :: [[Atom kon]]) (phi :: Nat -> *) 
  = Rep { unRep :: NS (PoA ki phi) code }

data AnnFix (ki :: kon -> *) (codes :: [[[Atom kon]]]) (ann :: Nat -> *) (n :: Nat) =
  AnnFix (ann n) (Rep ki (Lkup n codes) (AnnFix ki codes ann) )

type Fix ki codes = AnnFix ki codes (Const ())

Note I changed the parameter name to AnnFix from phi to ann. We should eventually do that.
Moreover, if we are messing with these datatypes, we will have to separate Fix and AnnFix.
I'm ok with that as long as Fix becomes a newtype after that. That is, It only makes sense
to decouple this dependency if we win something. I don't think pedagogical value counts here.
We have the papers that were written precisely for that.

@VictorCMiraldo VictorCMiraldo added this to the 2.0 milestone Mar 11, 2019
@VictorCMiraldo
Copy link
Owner

VictorCMiraldo commented Mar 11, 2019

Discussing with @arianvp we concluded:

  • Drop AnnFix and Fix dependency
  • The reordering of params won't happen. We can't do Lkup ix codes in Rep because we
    want to use Rep for opaque types aswell, ie, Rep :: Atom ki -> *.
  • We won't depend on sop-core. Our combinators are different than theirs and simpler than theirs.
    Bringing it in for two types is not worth it.

VictorCMiraldo added a commit that referenced this issue Mar 22, 2019
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

No branches or pull requests

3 participants