Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to cope with Haskell name space?
    primarykey
    data
    text
    <p>I'm writing a <code>data</code> record to marshall a <code>JIRA</code> <code>JSON</code> object. The problem is, multiple objects have the same labels for name/value pairs. For example :</p> <p>(returned from curl and formatted)</p> <pre><code>{"expand":"schema,names" ,"startAt":0 ,"maxResults":2 ,"total":74 ,"issues":[ {"expand":"editmeta,renderedFields,transitions,changelog,operations" ,"id":"183614" ,"self":"https://10.64.16.44/rest/api/latest/issue/183614" ,"key":"BNAP-339" ,"fields":{"versions":[ {"self":"https://10.64.16.44/rest/api/2/version/28240" ,"id":"28240" ,"name":"2012-12-07" ,"archived":false ,"released":false } ] ,"status":{"self":"https://10.64.16.44/rest/api/2/status/1" ,"description":"The issue is open and ready for the assignee to start work on it." ,"iconUrl":"https://10.64.16.44/images/icons/status_open.gif" ,"name":"Open" ,"id":"1" } ,"description":"Do Re Mi Fa" ,"resolution":null } } ] </code></pre> <p>when I construct the problematic corresponding Haskell <code>data</code> records I get:</p> <pre><code>data Issue = Issue {expand :: String ,id :: String ,self :: String ,key :: String ,fields :: Fields } deriving Generic data Version = Version {self :: String ,id :: String ,name :: String ,archived :: Bool ,released :: Bool } deriving Generic </code></pre> <p>and 'id' and 'self' will clash. It occured to me I could solve this by just changing the names in the records and fixing it with a manually-created <code>FromJSON</code> instance. Any alternative solutions would be welcome.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload