Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6962677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:41:29+00:00 2026-05-27T15:41:29+00:00

I am attempting to use Data.Aeson.TH deriveJSON to generate the ToJSON and FromJSON instances

  • 0

I am attempting to use Data.Aeson.TH deriveJSON to generate the ToJSON and FromJSON instances for MongoDB Data.Bson.

At the moment I am using:

$(deriveJSON id ''Data.Bson.Field)
$(deriveJSON id ''Data.Bson.Value)
$(deriveJSON id ''Data.Bson.Binary)
$(deriveJSON id ''Data.Bson.UUID)
$(deriveJSON id ''Data.Bson.UserDefined)
$(deriveJSON id ''Data.Bson.Regex)
$(deriveJSON id ''Data.Bson.Symbol)
$(deriveJSON id ''Data.Bson.MinMaxKey)
$(deriveJSON id ''Data.Bson.MongoStamp)
$(deriveJSON id ''Data.Bson.Javascript)
$(deriveJSON id ''Data.Bson.ObjectId)
$(deriveJSON id ''Data.Bson.MD5)
$(deriveJSON id ''Data.Bson.Function)
$(deriveJSON id ''Data.Bson.UString)

Which generates the following error at compile time:

Exception when trying to run compile-time code:
Data.Aeson.TH.withType: Unsupported type: TySynD Data.UString.UString [] (ConT Data.CompactString.UTF8.CompactString)
Code: deriveJSON (id) 'UString

I think the issue here is that the string inside the BSON document is a Ustring. I need to convert or otherwise map the the UString expected within the BSON data to another String type … but stumped as to how.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:41:30+00:00Added an answer on May 27, 2026 at 3:41 pm

    As I mentioned, Aeson does not support type synonyms, but nothing prevents us from unfolding UString.

    type UString = Data.CompactString.CompactString
    type CompactString = Data.CompactString.Internal.CompactString UTF8
    

    So, this one (instead of derive for UString) will work:

    $(deriveJSON id ''Data.CompactString.Internal.CompactString)
    $(deriveJSON id ''Data.CompactString.Encodings.UTF8)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to use the DatabaseFactory method from the Microsoft Enterprise Library. using Microsoft.Practices.EnterpriseLibrary.Data;
Attempting to use the data series from this example no longer passes the JSONLint
I am currently attempting to use Lucene to search data populated in an index.
I'm attempting to use the new standard way of loading seed data in Rails
Attempting to use the amazon API to obtain product data and currently failing miserably.
I am attempting to use the highcharts javascript library to load charts using this
Summary: When attempting to use marshalling to pass string data into a C++ DLL
I have table of data that I am attempting to use lattice in R
I am attempting to use JSON to send data between the browser and my
I'm attempting to use Backbone.js to simplify data (JSON) management and interaction with DOM.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.