[Haskell-cafe] Domain modeling
Jean Lopes
hawu.bnu at gmail.com
Thu Jan 30 14:58:59 UTC 2020
The main reason to have distinct types is the "natural" hierarchy of the
records (it's a big tree), for example, the 'C' block is roughly as follows:
C001
- C100
- C101
- C105
- C110
- C111
- C112
- C113
- C114
- C115
- C116
- C120
- C130
- C140
- C141
- C160
- C165
- C170
- C171
- C172
- C173
- C174
- C175
- C176
- C177
- C178
- C179
- C180
- C185
- C190
- C191
- C195
- C197
- C300
- C310
- C320
- C321
- C330
- C350
- C370
- C380
- C390
- C400
- C405
- C410
- C420
- C425
- C430
- C460
- C465
- C470
- C480
- C490
- C495
- C500
- C510
- C590
- C591
- C595
- C597
- C600
- C601
- C610
- C690
- C700
- C790
- C791
- C800
- C810
- C815
- C850
- C860
- C870
- C880
- C890
C990
There is more blocks that form the whole document (or tree), Blocks: 0, B,
C, D, E, G, H, K, I, 9
The idea is to parse the document and implement manipulation functions to
edit the content and later export in other formats
On Thu, Jan 30, 2020 at 6:56 AM Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk>
wrote:
> Jean Lopes <hawu.bnu at gmail.com> writes:
>
> > 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?
>
> Is there some reason why they must be different types?
>
> data C = C001 {other_stuff:: Real, indMov:: Bool } |
> C170 {other_stuff…, indMov:: Bool }
>
> is the first thing that comes to mind.
> --
> Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
>
>
> _______________________________________________
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200130/80f8f41a/attachment.html>
More information about the Haskell-Cafe
mailing list