[Haskell-cafe] Domain modeling

Andrew Martin andrew.thaddeus at gmail.com
Wed Jan 29 14:20:38 UTC 2020


I've been getting a lot of mileage from DuplicateRecordFields lately. You
just have to commit to not using labels as accessors. That is, no writing
`indMov x`. Instead, you have to write something like `myFunc C170{indMov}
= ...` (with NamedFieldPuns) or `myFunc C170{indMov=someBinder} = ...`.

On Wed, Jan 29, 2020 at 9:13 AM Jean Lopes <hawu.bnu at gmail.com> wrote:

> Hi!
>
> I'm trying to encode a domain which is full of simple records, and a lot
> of field name clashes.
>
> Here is a simple example, a.k.a. 1:1 with the domain-spec:
>
> data C001 {
>>   -- other stuff
>>   indMov :: Bool
>> }
>> data C170 {
>>   -- other stuff
>>  indMov :: Bool
>> }
>
>
> There is ~148 records with this field (indMov), all with the same meaning.
> What are my options to encode this in Haskell?
>
> - Prefix all record fields to avoid name clashes?
> - Use *DuplicateRecordFields*?
> - Typeclasses???
> - other options I am not aware of?
>
> which would you prefer? and why of course :)
>
> Thanks,
> Jean Lopes
>
>
>
> _______________________________________________
> 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.



-- 
-Andrew Thaddeus Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200129/99c03efa/attachment.html>


More information about the Haskell-Cafe mailing list