[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: [Haskell-cafe] Generic "annotations" on type definitions
From: Li-yao Xia <lysxia () gmail ! com>
Date: 2022-09-11 9:19:23
Message-ID: 56836e7a-586b-8623-b092-27be53c5d830 () gmail ! com
[Download RAW message or body]
> Doesn't this require TH? A primary constraint here is using generics
only, since TH has many undesirable properties.
What syntax the metadata comes in is orthogonal to whether it's provided
and processed using TH. That goes back to this previous question of yours:
> Would it be technically feasible to add such a thing to
GHC's Generics support?
Yes, it is technically feasible to extend GHC generics to reflect as
much metadata as you want. It's a matter of deciding what syntax it's
going to come in (whether in types, comments, or whatever else), how
it's going to be encoded (via an extra `Meta` field, constructor, or
whatever), and correspondingly adapting the code that generates Generic
instances.
However, changing GHC is something that takes a lot of effort. A
short-term compromise is to reimplement the deriving of Generic
instances in TH. TH would only be used for that, then the processing of
that metadata by applications can be done purely in Haskell.
Li-yao
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic