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...

Celý popis

Uložené v:
Podrobná bibliografia
Vydané v:Journal of functional programming Ročník 20; číslo 3-4; s. 303 - 352
Hlavní autori: OLIVEIRA, BRUNO C. D. S., GIBBONS, JEREMY
Médium: Journal Article
Jazyk:English
Vydavateľské údaje: Cambridge, UK Cambridge University Press 01.07.2010
ISSN:0956-7968, 1469-7653
On-line prístup:Získať plný text
Tagy: Pridať tag
Žiadne tagy, Buďte prvý, kto otaguje tento záznam!
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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AMDC
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 Core 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/eLvHCXMwtZ07T8MwEMdPfTCwUJ7i1SoDI1YaJ67tESEKqFKF1A7ZIj8uqEtBffD5sROnqmBiYEwUWcmdzvnbd_4dwJ2xnpJOGdGppSQTUhDNtSLGqYNhmRhmElU1m-DTqchz-daCvDkL48sqd4yDKpNf9Uf7rPGn8cLWNTS4imceocel52nV1JfYb1rGwQVFMHwbuk7BUBey3ddJ_jzdzdJuZSQaDp8fpcl4VjjpHyPvcxf2_j7j3v-99zEcBUUaPdR3TqCFy1PoNd0eohD8Z9CfOXeqyInc6N2zqhcmCsVdfuv7HObjp_njCwnNFYhxaySCIymRKYqUclVmSSmwTKnOqEqYdoHNhEDMODOlNUwlWicusO0o5e7aWKf6LqCz_FjiJUSWonETg6KpHWXSMIHSiUBdDpFJHCJewf3OMkX4zHVRV5fx4pc5rv_2-A0c1gl9X0F7C53Naot9ODBfm8V6NQheH0B7wsk3KMm7NA
linkProvider Cambridge University Press
linkToHtml http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwtZ07T8MwEMdPpUWChfIUr0IGRqI0TtzYI0KUVi0RUjtki_y4oC4BtYXPj504VQUTA2OsyHLOOefs--d3AHdKW0o6ob6MNPFjxpkvEyl8ZaKDfhEqqkJRFZtI0pRlGX9tQdb8C2NllRvGQZXJr-qjfdT402Chaw0NLoOZRegl3PK0aupLYA8tAzcFuTP8DnSsDsu4bGc8yZ7TzSptdkas4fDZXpqMZ4WT_tHzNndh6-sz7P7fuA_hwEWk3kPdcgQtLI-h21R78Jzzn0BvZqZTeCbI9d4sq3qhPCfuskffpzAfPs0fR74rruArs0fyccA5UkGQkEQUcVgwLCIiYyJCKo1jU8YQ44SqQisqQilD49h6ECXmWmkT9Z1Bu3wv8Rw8TVCZhUGQSA9irihDboJAWfSRcuwjXsD9xjK5e8xVXqvLkvyXOS7_dvst7I3mL9N8Ok4nV7BfJ_etmvYa2uvlJ_ZgV32tF6vljXsDvgG1qb1a
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