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

Deriving Via #3

Open
georgefst opened this issue Nov 14, 2019 · 0 comments
Open

Deriving Via #3

georgefst opened this issue Nov 14, 2019 · 0 comments

Comments

@georgefst
Copy link

georgefst commented Nov 14, 2019

It would be great if you exported a datatype along the lines of

newtype Pickle t = Pickle t deriving newtype Generic
instance (Generic t, GXmlPickler (Rep t), ConNames (Rep t)) => XmlPickler (Pickle t) where
    xpickle = gxpickle

Then users could use deriving via to derive instances, with even less boilerplate. e.g:

data User = User
  { name  :: String
  , admin :: Bool
  } deriving (Show, Generic)
    deriving XmlPickler via Pickle User

I may submit a PR for this if I can convince myself it's a safe use of UndecidableInstances.

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

1 participant