Scala for generic programmers
Datatype-generic programming (DGP) involves parametrization of programs by the shape of data, in the form of type constructors such as ‘list of’. Most approaches to DGP are developed in pure functional programming languages such as Haskell. We argue that the functional object-oriented language Scala...
Uloženo v:
| Vydáno v: | Journal of functional programming Ročník 20; číslo 3-4; s. 303 - 352 |
|---|---|
| Hlavní autoři: | , |
| Médium: | Journal Article |
| Jazyk: | angličtina |
| Vydáno: |
Cambridge, UK
Cambridge University Press
01.07.2010
|
| ISSN: | 0956-7968, 1469-7653 |
| On-line přístup: | Získat plný text |
| Tagy: |
Přidat tag
Žádné tagy, Buďte první, kdo vytvoří štítek k tomuto záznamu!
|
| Abstract | Datatype-generic programming (DGP) involves parametrization of programs by the shape of data, in the form of type constructors such as ‘list of’. Most approaches to DGP are developed in pure functional programming languages such as Haskell. We argue that the functional object-oriented language Scala is in many ways a better choice. Not only does Scala provide equivalents of all the necessary functional programming features (such as parametric polymorphism, higher-order functions, higher-kinded type operations, and type- and constructor-classes), but it also provides the most useful features of object-oriented languages (such as subtyping, overriding, traditional single inheritance, and multiple inheritance in the form of traits). Common Haskell techniques for DGP can be conveniently replicated in Scala, whereas the extra expressivity provides some important additional benefits in terms of extensibility and reuse. We illustrate this by comparing two simple approaches in Haskell, pointing out their limitations and showing how equivalent approaches in Scala address some of these limitations. Finally, we present three case studies on how to implement in Scala real DGP approaches from the literature: Hinze's ‘Generics for the Masses’, Lämmel and Peyton Jones's ‘Scrap your Boilerplate with Class’, and Gibbons's ‘Origami Programming’. |
|---|---|
| AbstractList | Datatype-generic programming (DGP) involves parametrization of programs by the shape of data, in the form of type constructors such as ‘list of’. Most approaches to DGP are developed in pure functional programming languages such as Haskell. We argue that the functional object-oriented language Scala is in many ways a better choice. Not only does Scala provide equivalents of all the necessary functional programming features (such as parametric polymorphism, higher-order functions, higher-kinded type operations, and type- and constructor-classes), but it also provides the most useful features of object-oriented languages (such as subtyping, overriding, traditional single inheritance, and multiple inheritance in the form of traits). Common Haskell techniques for DGP can be conveniently replicated in Scala, whereas the extra expressivity provides some important additional benefits in terms of extensibility and reuse. We illustrate this by comparing two simple approaches in Haskell, pointing out their limitations and showing how equivalent approaches in Scala address some of these limitations. Finally, we present three case studies on how to implement in Scala real DGP approaches from the literature: Hinze's ‘Generics for the Masses’, Lämmel and Peyton Jones's ‘Scrap your Boilerplate with Class’, and Gibbons's ‘Origami Programming’. |
| Author | GIBBONS, JEREMY OLIVEIRA, BRUNO C. D. S. |
| Author_xml | – sequence: 1 givenname: BRUNO C. D. S. surname: OLIVEIRA fullname: OLIVEIRA, BRUNO C. D. S. email: bruno@ropas.snu.ac.kr organization: ROSAEC Center, Seoul National University, 599 Gwanak-ro, Gwanak-gu, Seoul 151-744, South Korea (e-mail: bruno@ropas.snu.ac.kr) – sequence: 2 givenname: JEREMY surname: GIBBONS fullname: GIBBONS, JEREMY email: jg@comlab.ox.ac.uk organization: Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK (e-mail: jg@comlab.ox.ac.uk) |
| BookMark | eNplT0tqwzAUfJQU6qQ5QBYFX0Ctnv5altAfBLpI9kaSn0xCbBeZ3r827a6zGYYZZpg1rIZxIIAd8kfkaJ-O3GtjvXHIZ6DFG6hQGc-s0XIF1WKzxb-D9TRd5owT2lXwcEzhGuo8lrqjgco51V9l7EroeyrTPdzmcJ1o-8cbOL2-nPbv7PD59rF_PrDkLDIy3pMOgoSwISvMjrIUUYmAOnLFtXNEyuqU26QDxojO8tZIO-vUopcbkL-1KfSxnNuOmsv4XYZ5skHeLAebfwflD4O6Q9k |
| ContentType | Journal Article |
| Copyright | Copyright © Cambridge University Press 2010 |
| Copyright_xml | – notice: Copyright © Cambridge University Press 2010 |
| DOI | 10.1017/S0956796810000171 |
| DatabaseTitleList | |
| DeliveryMethod | fulltext_linktorsrc |
| Discipline | Computer Science |
| EISSN | 1469-7653 |
| EndPage | 352 |
| ExternalDocumentID | 10_1017_S0956796810000171 |
| GroupedDBID | -1D -1F -2P -2V -E. -~6 -~N .DC .FH 09C 09E 0E1 0R~ 29K 3V. 4.4 5GY 5VS 6OB 6~7 74X 74Y 7~V 85S 8FE 8FG 8R4 8R5 9M5 AAAZR AABES AABWE AACJH AAFUK AAGFV AAKTX AAMNQ AANRG AARAB AASVR AATMM AAUIS AAUKB ABBXD ABBZL ABEFU ABITZ ABJNI ABKKG ABMWE ABQTM ABQWD ABROB ABTAH ABTCQ ABUWG ABVFV ABVKB ABVZP ABXAU ABZCX ABZUI ACAJB ACBMC ACDLN ACETC ACGFS ACIMK ACMRT ACRPL ACUIJ ACYZP ACZBM ACZUX ACZWT ADCGK ADDNB ADFEC ADKIL ADNMO ADOVH ADOVT ADVJH AEBAK AEBPU AEHGV AEMFK AEMTW AENCP AENEX AENGE AEYYC AFFUJ AFKQG AFKRA AFLOS AFLVW AFUTZ AFZFC AGABE AGBYD AGJUD AGLWM AHQXX AHRGI AIGNW AIHIV AIOIP AISIE AJ7 AJCYY AJPFC AJQAS AKZCZ ALMA_UNASSIGNED_HOLDINGS ALVPG ALWZO AQJOH ARABE ARAPS ARZZG ATUCA AUXHV AYIQA AZQEC BBLKV BCGOX BENPR BESQT BGHMG BGLVJ BJBOZ BLZWO BMAJL BPHCQ BQFHP C0O CAG CBIIA CCPQU CCQAD CCTKK CCUQV CDIZJ CFAFE CFBFF CGQII CHEAL CJCSC COF CS3 D-I DC4 DOHLZ DU5 DWQXO EBS EGQIC EJD GNUQQ HCIFZ HG- HST I.6 I.7 I.9 IH6 IKXGN IOEEP IOO IPYYG IS6 I~P J36 J38 J3A JHPGK JQKCU K6V K7- KAFGG KCGVB KFECR L98 LHUNA LW7 M-V M0N M48 M7~ M8. NIKVX NMFBF NZEOI OK1 OYBOY P2P P62 PQQKQ PROAC PYCCK Q2X RAMDC RCA RIG ROL RR0 S6- S6U SAAAG T9M TWZ UT1 WFFJZ WQ3 WXU WYP YYM ZDLDU ZJOSE ZMEZD ZY4 ZYDXJ ~V1 |
| ID | FETCH-LOGICAL-c871-e699e5a2e227af41f8ef32b42a15b040588ee475cfdc5a1bb1870d637fdccd193 |
| IEDL.DBID | IKXGN |
| ISSN | 0956-7968 |
| IngestDate | Tue Jan 21 06:24:02 EST 2025 |
| IsDoiOpenAccess | false |
| IsOpenAccess | true |
| IsPeerReviewed | true |
| IsScholarly | true |
| Issue | 3-4 |
| Language | English |
| LinkModel | DirectLink |
| MergedId | FETCHMERGED-LOGICAL-c871-e699e5a2e227af41f8ef32b42a15b040588ee475cfdc5a1bb1870d637fdccd193 |
| OpenAccessLink | https://www.cambridge.org/core/services/aop-cambridge-core/content/view/223EB37E77EA36B27AE33A644DA70926/S0956796810000171a.pdf/div-class-title-scala-for-generic-programmers-div.pdf |
| PageCount | 50 |
| ParticipantIDs | cambridge_journals_10_1017_S0956796810000171 |
| PublicationCentury | 2000 |
| PublicationDate | 20100700 |
| PublicationDateYYYYMMDD | 2010-07-01 |
| PublicationDate_xml | – month: 07 year: 2010 text: 20100700 |
| PublicationDecade | 2010 |
| PublicationPlace | Cambridge, UK |
| PublicationPlace_xml | – name: Cambridge, UK |
| PublicationTitle | Journal of functional programming |
| PublicationTitleAlternate | J. Funct. Prog |
| PublicationYear | 2010 |
| Publisher | Cambridge University Press |
| Publisher_xml | – name: Cambridge University Press |
| SSID | ssj0008258 |
| Score | 1.8272077 |
| Snippet | Datatype-generic programming (DGP) involves parametrization of programs by the shape of data, in the form of type constructors such as ‘list of’. Most... |
| SourceID | cambridge |
| SourceType | Publisher |
| StartPage | 303 |
| Title | Scala for generic programmers |
| URI | https://www.cambridge.org/core/product/identifier/S0956796810000171/type/journal_article |
| Volume | 20 |
| hasFullText | 1 |
| inHoldings | 1 |
| isFullTextHit | |
| isPrint | |
| journalDatabaseRights | – providerCode: PRVAEN databaseName: Cambridge University Press Wholly Gold Open Access Journals customDbUrl: eissn: 1469-7653 dateEnd: 99991231 omitProxy: false ssIdentifier: ssj0008258 issn: 0956-7968 databaseCode: IKXGN dateStart: 19910101 isFulltext: true titleUrlDefault: http://journals.cambridge.org/action/login providerName: Cambridge University Press – providerCode: PRVPQU databaseName: Advanced Technologies & Aerospace Database customDbUrl: eissn: 1469-7653 dateEnd: 20241212 omitProxy: false ssIdentifier: ssj0008258 issn: 0956-7968 databaseCode: P5Z dateStart: 20010101 isFulltext: true titleUrlDefault: https://search.proquest.com/hightechjournals providerName: ProQuest – providerCode: PRVPQU databaseName: Computer Science Database customDbUrl: eissn: 1469-7653 dateEnd: 20241212 omitProxy: false ssIdentifier: ssj0008258 issn: 0956-7968 databaseCode: K7- dateStart: 20010101 isFulltext: true titleUrlDefault: http://search.proquest.com/compscijour providerName: ProQuest – providerCode: PRVPQU databaseName: Proquest Central customDbUrl: eissn: 1469-7653 dateEnd: 20241212 omitProxy: false ssIdentifier: ssj0008258 issn: 0956-7968 databaseCode: BENPR dateStart: 20010101 isFulltext: true titleUrlDefault: https://www.proquest.com/central providerName: ProQuest |
| link | http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwtV07T8MwED71wcBCeYpXqwyMWGmcOLZHhCigogqpFcoWxbGNupSqLfx-zolTVTAxMCaKrOQu3-XO9-U7gBuhMB7im0FsqoYkSbRBzClFRGyEdXLerJp1-PbCJxORZfK1BVnzL4yjVW41DqpOfjUfbVnLn4ZzXXNozCqcOgk9Lp2eVq36ErpNy9C7IPeGb0MXMxiKkO0-j7PHyTZKY2UkGh0-t0rT8azkpH-svKu7sPP1GfX-774P4cBnpMFdfeYIWmZxDL1m2kPgwX8C_Sm6swgwyQ3enVb1vAw8ucttfZ_CbPQwu38ifrgCKbFGIiaV0rCCGkp5YZPICmNjqhJaREwhsJkQxiSclVaXrIiUihDYOo05Hpcas74z6Cw-FuYcAq2GkcK0C0N4itWikCIeSlpylXDNpNUXcLu1TO4fc53X7DKe_zLH5d8uv4L9uqHvGLTX0NmsPk0f9sqvzXy9GnivD6A95uQbqhy6Tg |
| linkProvider | Cambridge University Press |
| linkToHtml | http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwtV07T8MwED6VFgkW3ohXIQMjUZqHY3tEiNKqJUJqhbJF8Qt1Kagt_H7OiVNVMDEwJoqs5Ozvcuf7_B3ALRPoD3Fl-CYVPT9JlEbMCeGzWDNj5bxJ1evwdUyzjOU5f2lB3pyFsbTKtcZBVcmv-qN91PKnwUzVHBq9CCZWQo9yq6dVq74EdtMycFNQOMNvQcfysBCyneEof8rWXhozI9bo8NlRmopnJSf9Y-RN3YWNv09____e-wD2XETq3dd3DqGl50ew33R78Bz4j6E7weksPQxyvTerVT2TniN32a3vE5j2H6cPA981V_Al5ki-TjnXpIx0FNHSJKFh2sSRSKIyJAKBTRjTOqFEGiVJGQoRIrBVGlO8lgqjvlNoz9_n-gw8JXqhwLALXXiK2SLjLO7xSFKRUEW4Uedwt7ZM4T5zWdTsMlr8MsfF3x6_gZ3B9HlcjIfZ6BJ26-K-ZdNeQXu1-NRd2JZfq9lyce1WwDcxp7x0 |
| openUrl | ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fsummon.serialssolutions.com&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.atitle=Scala+for+generic+programmers&rft.jtitle=Journal+of+functional+programming&rft.au=OLIVEIRA%2C+BRUNO+C.+D.+S.&rft.au=GIBBONS%2C+JEREMY&rft.date=2010-07-01&rft.pub=Cambridge+University+Press&rft.issn=0956-7968&rft.eissn=1469-7653&rft.volume=20&rft.issue=3-4&rft.spage=303&rft.epage=352&rft_id=info:doi/10.1017%2FS0956796810000171&rft.externalDocID=10_1017_S0956796810000171 |
| thumbnail_l | http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/lc.gif&issn=0956-7968&client=summon |
| thumbnail_m | http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/mc.gif&issn=0956-7968&client=summon |
| thumbnail_s | http://covers-cdn.summon.serialssolutions.com/index.aspx?isbn=/sc.gif&issn=0956-7968&client=summon |