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

Expose constructors #61

Open
ocramz opened this issue Aug 29, 2022 · 3 comments
Open

Expose constructors #61

ocramz opened this issue Aug 29, 2022 · 3 comments

Comments

@ocramz
Copy link
Owner

ocramz commented Aug 29, 2022

At least two people in the past week mentioned use cases for constructing XML :

@ocramz
Copy link
Owner Author

ocramz commented Aug 29, 2022

I guess exposing lenses as in #57 would be a more general fix

@tchoutri
Copy link

@ocramz Thank you for opening this! Personally I think that having integrated builders into xeno and optional lens bindings works best, as it is good form to stick with 1 lens library in a codebase. It would be hard to tell people to bring in a whole other ecosystem of lens libraries just for one dependency.

@tonyday567
Copy link

for my use case, I was looking for a representation of something like:

data NodeUnpacked = NodeUnpacked { name :: ByteString, attributes :: [(ByteString, ByteString)], contents :: [ContentUnpacked] }

-- | Content of a node.
data ContentUnpacked
  = ElementUnpacked {-# UNPACK #-}!NodeUnpacked
  | TextUnpacked {-# UNPACK #-}!ByteString
  | CDataUnpacked {-# UNPACK #-}!ByteString
  deriving (Eq, Show, Data, Typeable)

I've never really dug into xeno, though, and I don't know if this type of unpacked representation is compatible with the objectives of this library.

If it is, then my concept of a XML constructor is an iso for switching between Node and NodeUnpacked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants