[Hs-Generics] pervasiveness of Rec in TH-derived instant-generics representation types

Nicolas Frisby nicolas.frisby at gmail.com
Wed Feb 16 23:03:21 CET 2011


In instant-generics-0.2.1, the TH functions for deriving the Rep type
instances insert the "Rec" type at every field. Is there a consequence
to this?

This behavior seems at odds with the paper; isn't Rec only meant as an
indicator of recursive occurrences within the original data type?

Thanks.

---

snippet from http://j.mp/gK8MOk ; repField is invoked for every field
of every constructor by all of the relevant TH entry-points.

  repField :: (Name, [Name]) -> Type -> Q Type
  --repField d t | t == dataDeclToType d = conT ''I
  repField d t = conT ''Rec `appT` return t

  repField' :: (Name, [Name]) -> Name -> (Name, Strict, Type) -> Q Type
  --repField' d ns (_, _, t) | t == dataDeclToType d = conT ''I
  repField' (dt, vs) ns (f, _, t) = conT ''Rec `appT` return t
  -- Note: we should generate Var too, at some point



More information about the Generics mailing list