<<

e gritique of ƒt—nd—rd wv

endrew ‡F eppel €rin™eton niversity revised version of gƒE„‚EQTREWP xovem˜er IPD IWWP

e˜str—™t I ‡hy s like wv

ƒt—nd—rd wv is —n ex™ellent l—ngu—ge for sn this se™tion s list the re—sons why s like proE m—ny kinds of progr—mmingF st is s—feD efE gr—mming in wvD in de™re—sing order of import—n™eF ™ientD suit—˜ly —˜str—™tD —nd ™on™iseF „here ƒome fe—tures of the l—ngu—ge for whi™h wv is esE —re m—ny —spe™ts of the l—ngu—ge th—t work pe™i—lly known f—ll surprisingly f— down the listF wellF

roweverD nothing is perfe™tX ƒt—nd—rd wv h—s ƒ—fety — few short™omingsF sn some ™—ses there —re gert—in progr—mming errors ™—nnot —lE o˜vious solutionsD —nd in other ™—ses further rese—r™h is requiredF w—ys ˜e dete™ted ‘˜y — ™ompiler“D —nd must ˜e ™he—ply dete™t—˜le —t run timeY in no ™—se ™—n they ˜e —llowed to give rise to „he wet—Ev—ngu—ge of the idin˜urgh vgp m—™hineE or implement—tionEdependent efE theoremEproving system ‘IP“ evolved into — freeE fe™tsD whi™h —re inexpli™—˜le in terms of st—nding progr—mming environment ‘U“ —nd then the l—ngu—ge itselfF „his is — ™riterion to into ƒt—nd—rd wv ‘PWD PT“F efter further evolution whi™h s give the n—me se™urityF the l—ngu—ge is f—irly st—˜le ‘QI“F gF eF ‚F ro—reD IWUQF ‘IQ“ „his is — ™ritique of the l—ngu—ge from two perE spe™tivesX the user9s —nd the implementor9sF „he yne of the most ple—s—nt things —˜out wv is th—t rst p—rt of this p—per des™ri˜es why wv is — ple—sE it is s—feX progr—ms ™—nnot ™orrupt the runtime sysE —nt l—ngu—ge to useD —nd the se™ond shows how some tem so th—t further exe™ution of the progr—m is not of these l—ngu—ge fe—tures —re interesting to ™ompileF f—ithful to the l—ngu—ge sem—nti™sFI xelson ‘QP“ diE „hen the third —nd fourth p—rts of the p—per point vides progr—mming l—ngu—ges into three geneologiE out some of the —nnoy—n™es wv progr—mmers —nd ™—l ™—tegoriesX „he fg€v f—milyD in™luding g —nd implementors h—ve to de—l withF gCCD whi™h —re not s—feY the elgol f—milyD in™ludE ing €—s™—l —nd ed—D whi™h —re —lmost s—feY —nd the

ƒupported in p—rt ˜y xƒp gr—nt gg‚EWHHPUVTF I„h—nks to the wodul—EQ m—nu—l ‘QP“ for this phr—sing

I ’m—them—ti™—lly derived4 f—milyD in™luding vispD modern l—ngu—gesD from —ll three of the f—milies wvD ƒm—llt—lkD —nd gv D whi™h —re s—fe|ex™ept mentioned —˜oveD h—ve dyn—mi™ stor—ge —llo™—tionF when visp progr—mmers dis—˜le runtime type ™he™kE futD in gener—lD only l—ngu—ges of the ’m—them—tiE ing ˜e™—use it9s too expensiveF @„here —reD of ™ourseD ™—l4 ™—tegory h—ve —utom—ti™ g—r˜—ge ™olle™tionF sn l—ngu—ges su™h —s py‚„‚ex —nd gyfyv th—t do the fg€v —nd elgol f—miliesD dyn—mi™ stor—ge th—t not f—ll into these ™—tegoriesFA is no longer —™tive must ˜e expli™itly freed ˜y the sn — s—fe l—ngu—geD —ll errors th—t ™ould ’deE progr—m if it is to ˜e reEusedF st is pr—™ti™—lly imE r—il4 the progr—m @™—use ˜eh—vior not expl—in—˜le possi˜le @iFeFD no one knows howA to m—ke — s—fe in terms of the sour™e l—ngu—geA —re dete™ted either l—ngu—ge with expli™it stor—ge de—llo™—tionF „his —t ™ompile time or —t run timeF P „his m—kes it is the m—in @though not the onlyA re—son th—t l—nE mu™h e—sier to re—son —˜out progr—m ˜eh—viorX if gu—ges of the elgol f—mily —re not ™ompletely s—feF —n expression uses the rst element — of — list lD we sn some g or €—s™—l progr—ms it is o˜vious ™—n ˜e —ssured th—t l is re—lly — list —nd not — misE where to put the free or dispose st—tementsF fut understood integerF purthermoreD — l—rge ™l—ss of when d—t— stru™tures get just — ˜it more ™ompliE stor—geE—llo™—tion mist—kes ™ommon to uns—fe l—nE ™—tedD it9s h—rder to predi™t when to dispose of gu—ges —re simply not possi˜le in wvF thingsF €rogr—mmers often resort to expli™it referE ‡hen f—lli˜le hum—ns —ttempt to write l—rge proE en™e ™ountsD or even to spe™i—lEpurpose m—rkE—ndE gr—ms to do ™ompli™—ted thingsD s—fety is very imE sweep g—r˜—ge ™olle™tors implemented —new for e—™h port—ntF yf ™ourseD s—fety is not the s—me thing ™l—ss of re™ordF —s freedom from ˜ugsF fut —t le—st the ˜ugs ™—n „he pro˜lem ˜e™omes worse —™ross module ˜e understood in the fr—mework of the l—ngu—ge seE ˜ound—riesF sf — ’server4 module implements —n —˜E m—nti™s @form—l or inform—lAF „here is no ˜eh—vior str—™tion using dyn—mi™ stor—geD then the ’™lient4 th—t ™—nnotD in prin™ipleD ˜e predi™ted from the proE module won9t know the form—t of the re™ords to gr—m textF dispose of themF fut the server won9t know when sn —n uns—fe l—ngu—geD progr—m ˜ugs th—t ™orrupt the ™lient is nished with the —˜str—™t o˜je™tsF e the runtime system —re usu—lly the most di™ult to typi™—l solution is to —dd new oper—tors to the —˜E di—gnose —nd h—ve the most dis—strous ee™tsF fut str—™t interf—™e for freeing of —˜str—™t o˜je™tsF „his in — s—fe l—ngu—geD even ˜uggy progr—ms st—y within qui™kly ˜e™omes tediousF the ’sem—nti™ model4 of the l—ngu—geD whi™h m—kes ƒtor—ge —llo™—tion ˜ugs ™—n ™orrupt the runtime progr—m development mu™h e—sierF systemD or go undete™ted until millions of proE gr—m st—tements h—ve ˜een exe™uted —fter the erE rorF „hus they —re p—rti™ul—rly n—sty to di—gnoseF q—r˜—ge ™olle™tion ƒ—fe l—ngu—ges of the ’m—them—ti™—l4 f—milyD inE q—r˜—ge ™olle™tion frees the progr—mmer from ™—lE ™luding ƒt—nd—rd wvD h—ve —utom—ti™ g—r˜—ge ™olE ™ul—ting the lifetime of every o˜je™t in order to de—lE le™tion —nd —void this kind of ˜ug entirelyF lo™—te itF ‡ith —utom—ti™ stor—ge m—n—gement it is possi˜le to write progr—ms more ™on™iselyD eleg—ntlyD gompileEtime type ™he™king —nd —˜str—™tlyY one ™—n m—nipul—te v—luesD inste—d €rogr—mmers m—ke mist—kesF iven when they h—ve of o˜je™ts whose —ddresses must ˜e remem˜ered so proved their —lgorithms ™orre™t in some form—l or they ™—n ˜e freedF inform—l senseD it9s di™ult to —void —ll errors when iven with — g—r˜—ge ™olle™torD the progr—mmer tr—nsl—ting into the ™on™rete form—l not—tion of — should —void keeping unne™ess—ry pointers to useless progr—mming l—ngu—geF ƒin™e s —m p—rti™ul—rly o˜je™ts lest the progr—m use too mu™h sp—™eY o™™—E sl—pd—sh in my progr—mmingD perh—ps s m—ke even sion—lly it m—y ˜e ne™ess—ry to —n—lyze —nd rewrite more mist—kes th—n the —ver—ge progr—mmerF p—rts of the progr—m to —void keeping d—t— stru™E ƒo s must nd my mist—kes —nd x themF eny tures live ‘QU“‘RD ™h—pter IP“F fut this perform—n™e help th—t the progr—mming environment ™—n give tuning is prefer—˜le to the ’™orre™tness tuning4 ne™E me in nding mist—kes is most wel™omeF es — pr—™E ess—ry in — l—ngu—ge with expli™it disposeF ti™—l m—tterD s h—ve found th—t the v—st m—jority of ‡ithout g—r˜—ge ™olle™tionD it is di™ult to m—ke my mist—kes —re found —t ™ompileEtime ˜y the wv — s—fe l—ngu—ge th—t does interesting thingsF ell type ™he™kerF „hese mist—kes —re p—rti™ul—rly e—sy Psn wvD —nything dete™ted —t run time is ™onsidered to to xD ˜e™—useX ˜e —n ’ex™eptionD4 not —n ’errorY4 ex™eptions in™lude su™h events —s —rithmeti™ overowD —rr—yE˜ounds errorsD —nd t—kE  gompiling something t—kes less time th—n ™omE ing the he—d of —n empty listF piling —nd running itF

P  yne ™ompil—tion ™—n nd m—ny ™ompileEtime @with ™ode gener—tionA ˜efore —ny —™tu—l p—r—meE errorsY it9s h—rder to nd sever—l ˜ugs with one ter is presentedF „he s—me —rguments in f—vor of run @or even one ™ompile —nd sever—l runsA of ™ompileEtime type ™he™king —lso f—vor the ™he™king — progr—mF of fun™tors when they —re p—rsedD independently of the —rguments to whi™h they might ˜e —ppliedF  gompileEtime errors —re ™—ught reg—rdless of sn — l—ngu—ge with p—r—meterized modules —nd the input d—t—Y runEtime type errors m—y not ˜e —˜str—™t d—t— typesD it9s ne™ess—ry to ™he™k th—t — ™—ught until the progr—m is exer™ised on m—ny given —˜str—™t type —lw—ys refers to the s—me ™onE inputsF ™rete represent—tion|˜ut —t the s—me timeD withE  gompileEtime errors often ™ome with helpful out ’giving —w—y4 the represent—tionF sn ed— —nd expl—n—tionsY runEtime errors ™—n ˜e h—rder to wodul—EQ su™h ™he™king is possi˜le ˜e™—use ’™omE di—gnoseF pil—tion4 @—nd type ™he™kingA of the p—r—meterized module ˜ody is done for e—™h —ppli™—tion to —™tu—l pin—llyD ™ompileEtype types @espe™i—lly the eleE p—r—metersF wv uses the sh—ring spe™Q to require g—nt of wvA help me to underst—nd th—t two fun™tor p—r—meters must use the s—me repE my progr—m in — ™onsistent w—yD so th—t perh—ps s resent—tion for — sh—red —˜str—™t d—t— typeF m—ke fewer mist—kes in the rst pl—™eF por ex—mpleD suppose the sign—ture @interf—™eA st is interesting to note th—t most l—ngu—ges of the reƒr spe™ies — module to m—p strings to unique ’m—them—ti™—l4 f—mily h—ve h—d runEtime type sysE tokensF „here —re ™ert—inly dierent w—ys to impleE tems @in vispD ƒ™hemeD ƒm—llt—lkD e€vD et™FAD while ment this sign—tureY —nd even the s—me implement—E the elgolElike l—ngu—ges h—ve h—d ™ompileEtime type tion might exist in multiple inst—n™esD m—int—ining ™he™kingF €erh—ps this is ˜e™—use the ’m—them—tiE dierent h—sh t—˜lesF xowD if — p—rser module €—rse ™—l4 l—ngu—ges h—ve g—r˜—ge ™olle™torsY g—r˜—ge ™olE with sign—ture €e‚ƒi produ™es p—rse trees ™ont—inE le™tors require some runEtime type inform—tion to ing tokensD —nd — type ™he™king module „ype™he™k tr—™e re—™h—˜le o˜je™tsY —s long —s the type inforE @with sign—ture „‰€igriguA —lso de—ls with tokensD m—tion is in the runEtime d—t— there is — tempt—tion they ™—n ˜e ™om˜ined using — p—remeterized modE to use itY or perh—ps no one knew how to do good ule gompilerX ’m—them—ti™—l4 ™ompileEtime typeE™he™king ˜efore wv9s type system ‘PV“ w—s inventedF yf ™ourseD runE fun™tor gompiler@ stru™ture € X €e‚ƒi time type ™he™king ™—n ˜e slowY ˜ut the ’m—them—tE stru™ture „ X „‰€igrigu i™—l4 l—ngu—ges h—ve not h—d r—w speed —s — prim—ry sh—ring €Fr—sh a „Fr—sh design ™on™ernF sn wvD the —˜sen™e of runEtime A a F F F ™he™king does m—ke for more e™ient implement—E „he —dv—nt—ge of p—r—meterizing gompile is th—t it tionY this will ˜e dis™ussed ˜elowF ™—n ˜e —pplied to dierent p—rsers or dierent typeE ™he™king —lgorithms l—ter onF fut the progr—m will „he module system ˜e me—ningless unless the p—rti™ul—r €—rse modE ule we use relies on the s—me r—sh t—˜le —s the wv h—s — module system supporting —˜str—™t d—t— „ype™he™k module doesF end|even worse|if the typesD hiding of represent—tionsD —nd typeE™he™ked intern—l represent—tion of the unique tokens is suE interf—™esF wodules —re very import—nt in stru™turE ™iently dierentD then the progr—m is not even s—fe ing l—rge softw—re systemsF from mist—king pointers from integersD et™F wv9s wu™h h—s ˜een written —˜out the —dv—nt—ges of module system m—y ˜e unique in s—fely ™om˜ining modules —nd —˜str—™t d—t— typesF „he ’™l—sses4 of ™ompiled p—r—meterized modules with —˜str—™t d—t— y˜je™tEyriented progr—mming —re — kind of modE typesF uleD —nd support —˜str—™tion ni™elyY —s —re the ’modules4 of wodul— —nd ed—F st is not ™ontroE versi—l to s—y th—t modules with enfor™ed interf—™es smmut—˜le v—lues —nd represent—tionEhiding —re —n essenti—l fe—ture of — modern progr—mming l—ngu—geF sn — fun™tion—l l—ngu—ge one des™ri˜es the rel—tionE wv9s module system is p—rti™ul—rly ni™eD in th—t ships ˜etween v—luesD not o˜je™tsF s will illustr—te it —llows one module to ˜e p—r—meterized ˜y the inE with — silly ex—mpleF gonsider the st—tements @in terf—™e of —notherF ed—‘I“ —nd wodul—EQ‘QP“ —lso some progr—mming l—ngu—geAD support ’generi™4 modules th—t —re p—r—meterized Qren™eforth s will use spe™ to me—n the synt—™ti™ ™onE in this w—yF roweverD wv is unusu—l in th—t its p—E stru™t in wv sign—turesD —nd spe™i™—tion in — more gener—lD r—meterized modules|fun™tors|™—n ˜e ™ompiled inform—l senseF

Q x Xa ICT ‘RQ“F fut there —re millions of progr—mmers who y Xa PCS h—ve su™iently ™omprehended the notion of —ssignE xowD to re—son —˜out the rel—tionship ˜etween x ment —nd upd—te—˜le d—t— stru™tures to write su™E —nd yD one might —sk the following questionsX ™essful progr—msF yf ™ourseD the s—me —rgument ™ould ˜e m—de for ˜ringing ˜—™k the goto —nd  ss x the s—me U —s yc the TREkilo˜yte —ddress sp—™eF fut it is true th—t  sf we modify xD does y ™h—ngec progr—mming with upd—tes is — proven te™hnologyD —nd progr—mming entirely without them is still ’reE  xeed we m—ke — ™opy of U to implement zXaxc se—r™hF4 xowD other l—ngu—ges h—ve ™om˜ined — fun™tion—l  ‡hen we9re done with x how do we dispose of style with the ™—p—˜ility to do upd—tes|ƒ™hemeD the Uc for ex—mpleF fut the question isD how ™—n these two sf these questions seem sillyD ™onsider the —n—logous styles ˜e ™om˜ined without losing the ˜enets of the ™—se for this progr—m fr—gmentX immut—˜le v—luesc yn™e upd—tes —re permittedD the x Xa ™ons@—D˜A ’silly4 questions posed in the previous se™tion ˜egin y Xa ™ons@—D˜A to h—ve ™ompli™—ted —nswersF xowD is x the s—me list ™ell —s yc sf we modify wv solves this pro˜lem ˜y ™—refully segreg—ting ™—r@xAD does y ™h—ngec ‡hen should we m—ke — the mut—˜le —nd the immut—˜le typesF en integer ™opy of the ™ons ™ellc row do we dispose of itc v—lues h—s type intD —nd — mut—˜le ™ell ™ont—ining „he dispos—l question is —dequ—tely h—ndled in —n integer h—s type int refY these types —re not l—ngu—ges with g—r˜—ge ™olle™tionD of ™ourseF fut the s—meF yne ™—n fet™h the @immut—˜leA v—lue out the upd—te —nd identity questions —re notF st is of —n int ref —nd ˜ind it to — v—ri—˜le of type intY very distr—™tingD when writing —nd underst—nding — one ™—n store — dierent @immut—˜leA v—lue in the progr—mD to worry —˜out sh—ring of su˜stru™turesD int refF ‚eferen™e v—lues —re the only ones for sideEee™tsD —nd —li—singF @en optimizing ™ompiler whi™h questions of sh—ring —nd identity —re imporE is distr—™ted ˜y these pro˜lems too3A t—ntF „hese questions —re —ll silly for integers ˜e™—use ‚eferen™e ™ells ™—n ˜e ™omponents of d—t— stru™E we tre—t integers —s v—luesD not o˜je™tsF sf we ™onE turesF por ex—mpleD tree shown ˜elow is the type sidered integers —s o˜je™tsD perh—ps with — ™omE of immut—˜le trees with integer le—vesY elements of m—nd to ’upd—te4 some of the ˜its of —n integer o˜E treeI —re trees whose le—ves m—y ˜e modied ˜ut je™tD then the ™omplexities listed —˜ove would h—ve whose stru™ture is immut—˜leF yn the ™ontr—ryD the to ˜e ™onsidered ˜y —nyone progr—mming with inE le—ves of treeP —re immut—˜le ˜ut the stru™ture ™—n tegersF ˜e reE—rr—nged @—nd entirely new le—ves ™—n ˜e inE †—lues h—ve m—ny —dv—nt—ges over o˜je™tsF ƒh—rE sertedAX ing of the su˜stru™tures of v—lues never le—ds to pro˜lems if the su˜stru™tures ™—n9t ˜e modiedF yne doesn9t need to re—son —˜out equ—l versus idenE d—t—type tree ti™—l v—lues|—nd to ensure th—t this is trueD wv a viep of int does not permit testing —ddress equ—lity on imE | xyhi of tree B tree mut—˜le typesF yne ™—n perform indu™tion over stru™ture to prove useful things —˜out v—luesY for d—t—type treeI o˜je™ts one h—s to do indu™tion over their historiesD a viep of int ref whi™h ™ompli™—tes re—soning —˜out themF | xyhi of treeI B treeI d—t—type treeP wut—˜le o˜je™ts a viep of int iven though v—lues h—ve m—ny ni™e propertiesD the | xyhi of treeP ref B treeP ref notion of mut—˜le o˜je™ts should not ˜e dis™—rdedF ynly —n extremist would s—y th—t upd—te—˜le ™ells wut—˜le referen™e ™ellsD whi™h —re ™—refully idenE —re —lw—ys too h—rd to use —nd underst—ndF „he tied in —dv—n™e to the ™ompiler —nd the hum—n extremists might yet ˜e proved rightX it is ™ert—inly re—der of the progr—mD h—ve turned out to ˜e — very true th—t —ny —lgorithm on o˜je™ts ™—n ˜e simuE good ™ompromiseF „hey —llow v—lueE˜—sed re—sonE l—ted on v—luesD —nd re™ent work h—s m—de su™h ing —˜out nonEreferen™esD —nd the use of upd—tes —lgorithms ever more re—d—˜le —nd underst—nd—˜le where ne™ess—ryF

R €olymorphi™ types overspe™ify it —s intF ƒo the length fun™tionD just —s writtenD h—s type  list 3 int for —ny D —nd „he impli™it p—r—metri™ polymorphism of wv is — ™—n ˜e —pplied to lists of stringsD lists of re—lsD lists gre—t ™onvenien™eF sn writing — g or €—s™—l progr—m of listsD —nd so onF th—t de—ls in linked lists of sever—l dierent types of o˜je™tsD for ex—mpleD it is ˜othersome to h—ve to ™opy —lmost ver˜—tim the denitions of fun™E gomplete form—l denition tions to ™re—te listsD m—p fun™tions over listsD reE verse listsD ™—l™ul—te lengths of listsD —nd so onF sn „he progr—mming l—ngu—ge €—s™—l w—s —n —dv—n™e wvD —s in vispD the s—me m—p fun™tion ™—n operE in l—ngu—ge designD —nd ˜e™—me very popul—rD for —te on — list of —nythingD —nd simil—rly for lengthD sever—l re—sonsF st supported ™le—n —nd useful reverseD —nd ™onsF „he length fun™tion is polyE ™ontrol stru™tures —nd d—t— stru™turesF st is — morphi™X it h—s the type int list 3 int —nd sm—ll enough l—ngu—geD —nd w—s spe™ied pre™isely the type string list 3 int —nd m—ny others ˜eE enough @in inform—l proseA ‘IT“ th—t people ™ould sidesF sn o˜je™tEoriented l—ngu—ges with inheriE underst—nd wh—t €—s™—l progr—ms should doF t—n™eD polymorphism ™—n ˜e —™hieved without mu™h fut €—s™—l still h—s ’—m˜iguities —nd inse™urities4 di™ulty @depending on the l—ngu—geAF fut in gD ‘RT“F „h—t isD the l—ngu—ge denition is —m˜iguous polymorphism ™—n ˜e —™™omplished only ˜y using —˜out the me—ning of ™ert—in ™onstru™ts @—nd difE ™—st to —void the typeE™he™kerD —nd in €—s™—l only ferent ™ompilers give dierent results on the s—me ˜y ™lumsy use of v—ri—nt re™ordsF progr—mAY —nd the l—ngu—ge is inse™ureX it is not s—fe in the sense des™ri˜ed ˜y ro—reF „ype inferen™e wv is not only se™ureD it is —lso un—m˜iguously sn wv it is neverR ne™ess—ry to de™l—re types for denedF „he henition of ƒt—nd—rd wv ‘QI“ is — v—ri—˜les or for fun™tions —nd their form—l p—r—mE ™omplete oper—tion—l sem—nti™s for the entire l—nE etersF „he ™ompiler ™—n infer types for these idenE gu—geF yne ™—n use the henition to ™—l™ul—te exE tiersD —nd it ™he™ks th—t the v—ri—˜les —re used —™tly whi™h progr—ms should ˜e —™™epted ˜y — ™omE ™onsistentlyF „hus wv —™hieves the —dv—nt—ges of pilerD —nd wh—t their result will ˜eF ™ompileEtime typeE™he™king with the ™on™iseness of purthermoreD the henition @with —™™omp—nying unde™l—red typesF ™omment—ry ‘QH“A is re—d—˜le|—s form—l sem—nti™ „his is — ™onvenien™eD ˜ut of ™ourse it doesn9t denitions goF „his does not me—n th—t the deE shorten progr—ms ˜y —n enormous f—™torX in l—nE nition is suit—˜le —s — m—nu—l for the progr—mmerY gu—ges with expli™itly de™l—red typesD the type de™E there is too mu™h form—l not—tion —nd not enough l—r—tions don9t overwhelm the progr—mF e ˜ig —dE worked ex—mples for th—tF fut the student of l—nE v—nt—ge of type inferen™e is th—t the ™ompiler infers gu—ge designD or the serious ™ompilerEwriterD ™—n the most gener—l @polymorphi™A type for e—™h fun™E use the henition —s — referen™e to underst—nd the tionF „hen the progr—mmer doesn9t tend to prem—E me—ning of —ny ™onstru™t th—t might ˜e in dou˜tF turely overEspe™ify the types of fun™tionsF „his le—ds to port—˜ility ˜etween implement—tionsD por ex—mpleD ™onsider writing — length fun™tion prov—˜ility of progr—ms @in prin™ipleAD —nd ™onE to ™ompute the num˜er of integers in — listXS den™e in the s—fety —nd se™urity of wv progr—msF fun length @he—dXXrestA a I length@restA „he henition h—sD over timeD proved to ˜e | length @nilA a H tr—™t—˜le enough to serve —s the ˜—sis for useful fe™—use the progr—mmer needn9t spe™ify the type te™hni™—l dis™ussion —mong its m—ny re—dersF iven of the list element he—dD there is no tempt—tion to when there h—ve turned out to ˜e holes in the heE nitionD they ™—n ˜e dis™ussed —nd rep—ired with ™onE R wellD h—rdly everY see the se™tion on yverlo—dingF den™e —nd —greement over wh—t the ™h—nges me—nF Se list in wv ™—n ˜e emptyD or nilD or ™—n ˜e ’™ons4 ™ell ™ont—ining — ’he—d4 @rst elementA —nd — e form—l denition is merely — ™ompli™—ted goodE ’t—il4 @the rest of the listAF „husD list is — disE lu™k ™h—rm unless it ™—n ˜e used to prove import—nt joint union typeD or d—t—typeD of the following formX properties of the l—ngu—geF „he henition is m—thE d—t—type 9— list a nil | XX of 9— B 9— list „he ™onstru™tors of this d—t—type —re nil —nd XX @proE em—ti™—lly tr—™t—˜le enough to proveD for ex—mpleD noun™ed ’™ons4AF ell the elements of — list must ˜e of th—t progr—ms th—t typeE™he™k will exe™ute ’s—felyD4 the s—me typeY if this type isD eFgFD  then the list is ™—lled th—t there ™—n ˜e no ’d—ngling referen™es4 @inv—lid —n  listF fe™—use key˜o—rds don9t h—ve qreek lettersD we pointersAD th—t the type inferen™e —lgorithm —lw—ys write  —s 9—F st is ™onvenient to m—ke XX inx —nd rightE —sso™i—tive ˜y def—ultD so th—t IXXPXXQXXnil is the list of the nds the most gener—l type for —n expressionD —nd rst three positive integersF m—ny other theorems th—t inspire ™onden™e in the

S sem—nti™s of the l—ngu—geT ‘QH“F no oper—tors @su™h —s ™on™—ten—teA th—t ™—n ™re—te „he proponents of form—l spe™i™—tions of proE new ™h—r—™terEstring v—lues —t run time3 „hen the gr—mming l—ngu—ges h—ve long ™l—imed th—t sem—nE ™h—r—™terEstring type would ˜e of limited utilityY ti™s should ˜e used —s — tool for l—ngu—ge designD not one might use it for printing inter—™tive prompts just for writing down the sem—nti™s of existing l—nE dened —t ™ompile timeD —nd so onF eny d—t— type gu—gesF „he ™on™iseness —nd ™ompleteness of the in whi™h one ™—n only p—ss —round ™ompileEtime litE wv henition stemD in p—rtD from the relu™t—n™e of er—lsD is h—rdly ’rstE™l—ssF4 the ƒt—nd—rd wv design ™ommittee to —dmit fe—E fut this is ex—™tly the situ—tion for fun™tion tures into the l—ngu—ge for whi™h they didn9t unE pointers in g3 „he only fun™tion v—lues —re those derst—nd how to write — prov—˜ly sound sem—nti™sF ™re—ted —t ™ompile timeY one ™—nnot m—ke ’new4 fun™tions like fI —nd fIH shown in the ex—mple righerEorder fun™tions —˜oveF „his is ˜e™—use g does not —llow nested fun™tions with lexi™—l s™opeF ƒimil—rlyD even though sn wvD —s in ƒ™heme —nd other l—ngu—ges derived wodul—EQ h—s nested fun™tions —nd lexi™—l s™opeD from the !E™—l™ulusD fun™tions —re rstE™l—ss v—lues only fun™tions —t the outermost level of nesting ™—n th—t m—y ˜e p—ssed —s —rgumentsD returned —s reE ˜e p—ssed —s —rgumentsF sultsD —nd put into d—t— stru™turesF yn the other h—ndD €—s™—l —llows nested fun™tions yf ™ourseD the g progr—mming l—ngu—ge h—s @with lexi™—l s™opeA to ˜e p—ssed —s —rgumentsD ˜ut ’rstE™l—ss4 fun™tionsD tooY ˜ut there is —n imporE not to ˜e returned —s results or stored in d—t— stru™E t—nt dieren™e ˜etween the fun™tion—l v—lues of wv turesF „his restri™tion limits the utility of fun™E —nd those of gF wv h—s nested fun™tion denitions tion v—luesF foth the g restri™tion —nd the €—sE with lexi™—l s™opeY the inner fun™tions ™—n refer to ™—l restri™tion —re motiv—ted ˜y the desire to —void lo™—l v—ri—˜les —nd form—l p—r—meters of the outer the need for g—r˜—ge ™olle™tionX rstE™l—ss fun™tions fun™tionsF „husD e—™h time —n outer fun™tion is with nested s™ope ™—nnot ˜e implemented with — invoked with dierent —™tu—l p—r—metersD — ’new4 ™onvention—l st—™k of —™tiv—tion re™ordsF fut when version of the inner fun™tion is ˜uiltF e simple exE the system h—s — g—r˜—ge ™olle™tor —lre—dyD rstE —mpleX ™l—ss nested fun™tion—l v—lues don9t —dd gre—t ™omE fun —dd@xX intA a plexity to the implement—tion of the l—ngu—geF let fun f@yA a xCy €erh—ps one must write some progr—ms with in f higherEorder fun™tions to re—lly —ppre™i—te their exE end pressivenessF roweverD s will present some ex—mples of their useX v—l sm—llin™ a —dd@IA v—l ˜igin™ a —dd@IHA ‚edu™tion fun™tions on listsX „—ke — ˜in—ry oper—tor @like C or AD —nd —pply it to —n entire v—l twelve a sm—llin™@˜igin™@IAA sequen™e of v—luesD thusX „he fun keyword introdu™es — fun™tion de™l—r—tionF —  —  XXX  —  I „he let de™ in exp end synt—x introdu™es — lo™—l I P n de™l—r—tion de™ visi˜le only in the expression expF @eppend the term I in order to —ppropriE „husD when —dd is —pplied to ID the fun™tion fI@yA a —tely h—ndle the ™—se where n a HFA „his noE IC y is ™re—ted —nd returned —s — resultF ‡hen tion ™—n ˜e e—sily gener—lizedX given —n operE —dd IH is ™omputedD the fun™tion fIH@yA a IH C y —tor opr —nd —n identity s for th—t oper—torD U is the resultF redu™e@oprY sA is the fun™tion th—t —pplies the sm—gineD for — momentD — progr—mming l—ngu—ge oper—tor to —n entire list of v—luesF „husD the in whi™h ™h—r—™terEstring v—lues ™—n ˜e stored in fun™tion sum th—t tot—ls the elements of — list v—ri—˜lesD p—ssed —s —rgumentsD returned —s reE is just redu™e@CY HA —nd produ™t is redu™e@Y IAF sultsY suppose there —re ™h—r—™terEstring liter—lsD sn wv one might writeX —nd it9s possi˜le to extr—™t the individu—l ™h—rE —™ters from string v—luesF fut suppose there —re fun redu™e@oprDsA a Tƒome of the theorems mentioned h—ve —™tu—lly ˜een let fun f@nilA a s proved only for su˜sets of ƒt—nd—rd wvF | f@—XXrestA a opr@—D f@restAA U „his —dd fun™tion ™—n ˜e written more ™on™isely —s in f fun —dd x y a xCyXint where the type ™onstr—int Xint is ne™ess—ry ˜e™—use of overE end lo—dingY see se™tion QF

T v—l sum a redu™e@op CD HA it is import—nt th—t wv ™—n ˜e ™ompiled to run v—l produ™t a redu™e@op BD IA e™ientlyF „here —re m—ny re—sons to ˜elieve th—t fun min@—D ˜XintA a if —`˜ then — else ˜ it ™—nF wv h—s ™ompileEtime type ™he™kingD whi™h v—l infinity a IHHHHHHHHH me—ns th—t type t—gs need not ˜e ™—rried —round —t v—l minlist a redu™e@minDinfinityA run timeD —nd oper—tors need not ™he™k the types of v—l fifteen a sum@IXXPXXQXXRXXSXXnilA their —rguments —t run timeF wv does not h—ve the ’dyn—mi™ method lookup4 required of m—ny o˜je™tE „he op keyword —llows —n inx oper—tor like B oriented l—ngu—gesF to ˜e used —s —n ordin—ry identierF wv does do —rr—yE˜ounds ™he™kingD whi™h is not present in g —nd whi™h slows things down unless ‡indow m—n—gerX yne ™ould org—nize — window s—fely removed ˜y — good optimizing ™ompilerF wv interf—™e so th—t —n —ppli™—tion running in does ™he™k pointers for nil ˜efore dereferen™ingY ˜ut — window is represented ˜y its key˜o—rd —nd the w—y this is in™orpor—ted in p—tternEm—t™hing V mouseF „o h—nd the —ppli™—tion ™h—r—™ters fe—ture of the l—ngu—geD these tests will ˜e p—rt of typed into its windowD one ™—lls its key˜o—rd the ordin—ry ™ontrol ow written ˜y the progr—mE fun™tionY to give it mouseE™li™ksD one ™—lls its merF @ nfortun—telyD sometimes the progr—mmer mouse fun™tionF „husX knows th—t — list ™—n9t ˜e nilD ˜ut the ™he™k must ˜e done —nyw—y ex™ept ˜y —n impossi˜ly intelligent type window•—pp a ™ompilerFA end wv ™he™ks for overow of —rithE {key˜o—rdX stringEbunitD meti™ expressionsD ˜ut on most ™omputers this is mouseX intBintEbunit} h—ndled ˜y the h—rdw—re without the need to issue extr— instru™tionsF „his s—ys th—t window•—pp is — re™ord type fut ™—n wv ˜e —s e™ient —s gc „o some extentD ™ont—ining two eldsD key˜o—rd —nd mouseF this is still — rese—r™h question @one th—t interests me key˜o—rd is — fun™tion th—t t—kes — string p—E very mu™hAF st9s — di™ult question to —nswerD ˜eE r—meter —nd returns ’unit4 @whi™h is — pl—™eE ™—use it requires th—t ’the s—me4 progr—m ˜e writE holder like ’void4 in gAD —nd mouse t—kes — ten ˜oth in g —nd in ƒt—nd—rd wvF end wh—t does ™oordin—teEp—ir —s —n —rgumentF xowD the winE it me—n to s—y th—t — progr—m written in idiom—ti™ dow m—n—ger ™—n p—ss keypresses —nd mouseE g is ’the s—me4 —s one written in idiom—ti™ wvc ™li™ks to the —ppli™—tion ˜y ™—lling these fun™E yne might m—ke — good —ttempt —t — qu—ntit—E tionsF „his h—s —n ’o˜je™tEoriented4 —vorY the tive me—surement ˜y rewriting some g progr—ms in priv—te d—t— of the —ppli™—tion @iFeFD ’self4 in idiom—ti™ wvD —nd vi™e vers—D —nd running the reE yy€ terminologyA is hidden in the free v—riE sults with ’good4 ™ompilers on the s—me h—rdw—reF —˜les of the two fun™tionsF sn g it would ˜e „his is — su™iently unrew—rding jo˜ th—t few peoE ne™ess—ry to in™lude —n expli™it ’self4 eld in ple h—ve done it on ’re—listi™4 progr—msF the window•—pp re™ordD —nd p—ss this —s —n exE yn the other h—ndD there —re m—ny good ƒ™heme tr— —rgument to key˜o—rd —nd mouseF ™ompilersF ‡hile ƒ™heme does not run —s e™iently wost of the interesting uses of rstE™l—ss fun™tions —s g on —ll pro˜lemsD ƒ™heme —nd gommon visp —re ™om˜ine the use of nested lexi™—l s™ope @where inner su™iently e™ient th—t m—ny re—l —ppli™—tions —re fun™tions9 free v—ri—˜les —re ˜ound in outer fun™E written in themF st should ˜e possi˜le to get wv to run —t le—st —s e™iently —s ƒ™hemeD sin™e the l—nE tionsA with fun™tions returned —s results or stored gu—ges —re simil—r in m—ny w—ys ˜ut wv doesn9t reE in d—t— stru™turesF „husD the very ™om˜in—tion th—t is left out of g —nd €—s™—l ˜e™—use it is di™ult to quire the runEtime type ™he™king th—t ƒ™heme doesF implement @it requires — g—r˜—ge ™olle™tor for —™tiE sn —ny ™—seD there is —t le—st one re—son—˜ly efE v—tion re™ordsA is the most usefulF ™ient implement—tion of wv ‘T“F „his —nd other implement—tions W h—ve m—ny usersD for whom they i™ien™y Wƒever—l ƒt—nd—rd wv implement—tions —re —v—il—˜leX  ƒt—nd—rd wv of xew terseyD from €rin™eton niE en eleg—nt l—ngu—ge will h—ve few —ppli™—tions if versity —nd e„8„ fell v—˜or—tories @™ont—™t —pE progr—ms written in it —lw—ys run too slowlyF ƒo peldprin™etonFeduA  €olyGwvD from e˜str—™t r—rdw—re vtdF @™ont—™t Ven interesting —nd useful windowing li˜r—ry h—s ˜een ˜o˜d—hlF™oFukA implemented in wv ˜y q—nsner —nd ‚eppy‘QT“ —s — very eleg—nt interf—™e to —n ˆ serverF „he ex—mple here does not  €oplog wvD from the niversity of ƒussex des™ri˜e their systemF @isldintegFuu™pD popd™sFum—ssFeduA

U —re —dequ—tely e™ientY this might not ˜e the ™—se ‚estri™tive type systemX wv9s type system is if they were too slow ˜y —n order of m—gnitudeF less restri™tive th—n th—t of most st—ti™—llyE wv progr—ms @run under some ™ompilersA h—ve typed l—ngu—ges @ex™ept thoseD like gD th—t —lE used mu™h more sp—™e th—n ™omp—r—˜le g proE low ev—sion of the type systemAF sn return for gr—msF „his is — serious pro˜lemD ˜ut re™ent reE o˜eying the type rulesD the progr—mmer is reE se—r™h ‘RD ™h—pter IP“ h—s hinted —t solutionsF et w—rded with ™ompileEtime error mess—ges inE presentD it —ppe—rs th—t wv is e™ient enough to ste—d of runEtime ˜ugsF use for — wide v—riety of —ppli™—tionsF g progr—ms —re f—ster pro˜—˜ly ˜y no more th—n — f—™tor of twoD wut—tion @—nd l—™k thereofAX wv m—kes it inE —nd often less th—n th—tF por m—ny purposesD wv9s ™ovenient @˜ut not extremely soA to modify —dv—nt—ges in s—fetyD eleg—n™eD e—se of stor—ge m—nE elds of d—t— stru™turesX su™h elds must ˜e —gementD —nd so on m—y outweigh this dieren™e in de™l—red in —dv—n™eF „his is just enough to perform—n™eF end progr—ms th—t require ™ompliE en™our—ge — fun™tion—l style of progr—mming ™—ted —nd expensive stor—ge m—n—gement in g m—y @whi™h is goodA with —n es™—pe h—t™h where run f—ster in —n wv implement—tion with — good ne™ess—ry @whi™h is —lso goodAF g—r˜—ge ™olle™tor ‘V“F v—™k of —™™ess to m—™hineX wv su™™eeds —ll too well in —˜str—™ting —w—y from the m—™hineF ‡hy some people don9t like wv „his m—kes it di™ult to implement those proE gr—ms th—t must do m—™hineElevel thingsD with en @—nonymousA e—rly reviewer of this p—per ™omE memory wordsD p—gesD prote™tionsD sign—lsD et™F pl—ined —˜out wv9s ’l—™k of dyn—mi™ typesD mut—E st is possi˜le to m—ke interf—™es to these things tion @—nd l—™k thereofAD l—™k of —™™ess to m—™hine @—s in wvY ˜ut it must still ˜e —dmitted th—t — in gAD restri™tive type systemD sm—ll ™h—nges usu—lly typi™—l wv system h—s — l—rge runtime system require ™omplete re™ompil—tionD ˜iz—rre synt—xD l—™k written in g to h—ndle the things th—t ™ouldn9t of m—™rosD et™F4 ˜e implemented in wvF „hese ™riti™isms merit some dis™ussionF ‚e™ompil—tionX ƒep—r—te ™ompil—tion is essenti—l v—™k of dyn—mi™ typesX „here —re some things in — progr—mming environmentF sn st—ti™—llyE th—t —re e—sier to do in — dyn—mi™—llyEtyped typed l—ngu—ges su™h —s g or wodul—D — system l—ngu—geF por ex—mpleD su˜typing is e—sy to do like m—ke ™—n re™ompile just those les th—t in vispD sin™e listEofEre—l is —utom—ti™—lly — su˜E m—y need itY in dyn—mi™—llyEtyped l—ngu—ges type of listEofE@re—lEorEstringAY —nd wv doesn9t su™h —s vispD only les —™tu—lly modied need h—ve — su˜typing me™h—nismF fut su™h ex—mE re™ompil—tion @in the —˜sen™e of m—™ro deniE ples —re not very ™ompellingY —n wv progr—m tionsD of ™ourseAF might h—ve — few more inje™tion —nd proje™tion fun™tions th—n — visp progr—mF smplement—tions of ƒt—nd—rd wv h—ve not usuE e more interesting use of dyn—mi™ types is for —lly h—d very good sep—r—te ™ompil—tion sysE temsF „his is p—rtly — pro˜lem with the l—nE progr—ms th—t wish to do typeEs—feD stru™tured gu—geD —s el—˜or—ted in se™tion RD ˜ut mostly — inputGoutputD whi™h is pro˜lem—ti™ in ƒt—nE d—rd wvF ‡ithin the wv ™ommunityD the type pro˜lem with the individu—l implement—tionsF dyn—mi™ h—s ˜een proposed —s — solution to sn —ny ™—seD it —ppe—rs to ˜e — pro˜lem th—t this pro˜lem‘PP“X v—lues of type dyn—mi™ would ™—n ˜e solved without modifying the l—ngu—ge ™—rry full wvEstyle types —s p—rt of their runE denitionF time represent—tionD —nd ™ould ˜e ™oer™ed into fiz—rre synt—xX visp synt—x h—s — wonderful ™onE ordin—ry st—ti™—llyEtyped v—lues with — runtime sisten™yD ˜ut is —n —™quired t—steF ƒt—nd—rd ™he™kF wv synt—x is — medio™re ex—mple of the elE  idin˜urgh wv RFHD from the niversity of idin˜urgh gol s™hoolD in whi™h keywords —re used inste—d @lf™sdedF—™FukA of some of the p—renthesesD —nd in whi™h inx  ex wvD from the eustr—li—n x—tion—l niversity oper—tors —re used where it m—kes sense to do @m™nd—nu™sdF—nuFozF—uA soF ƒome of the o˜vious ’˜ugs4 in the gr—mE  wi™rowvD from the niversity of me—D ƒweden m—r —re reported l—ter in this p—perY ˜ut in @olofd™sFumuFseA gener—lD don9t we h—ve ˜etter things to —rgue —˜out th—n synt—xc

V v—™k of m—™rosX „his is ™le—rly —n —dv—nt—geD not gompileEtime type ™he™king — dis—dv—nt—geF por the progr—mmer to h—ve to gompilers for l—ngu—ges with runEtime type ™he™kE ™—l™ul—te — stringEtoEstring rewrite of the proE ingD su™h —s visp —nd ƒm—llt—lkD must work very gr—m ˜efore —ny sem—nti™ —n—lysis invites pro˜E h—rd to minimize the exe™ution ™ost of type ™he™kE lems of the worst kindF ‡here m—™ros —re used ingF en —dv—nt—ge of wv @—nd —ll l—ngu—ges of the to —tt—in the ee™t of inEline exp—nsion of fun™E elgol —nd fg€v f—miliesA is th—t —ll type ™he™kE tionsD they —re doing something th—t should ˜e ing is done —t ™ompile timeD —nd does not slow the done ˜y —n optimizing ™ompilerF ‡here m—™ros exe™ution of the progr—mF —re used to —tt—in ™—llE˜yEn—meD the ee™t ™—n ˜e o˜t—ined ˜y p—ssing — suspension —s —n —rE gumentY in wv this is written with the synt—x ‚epresent—tion —n—lysis fn@Aab whi™h though —dmittedly ugly is f—irly „he types of v—ri—˜les in wv —re known su™iently ™on™iseD —nd is ˜etter th—n toler—ting the seE —t ™ompile time to gu—r—nteeD —s in elgolElike l—nE m—nti™ h—vo™ wrought ˜y m—™rosF g—ugesD th—t primitive oper—tors will never ˜e —pE plied to v—lues of the wrong typeF roweverD ˜eE ™—use of wv9s p—r—metri™ polymorphismD there —re P wv is fun to ™ompile other ™ontexts @su™h —s inside the ™ons fun™tionA in whi™h the types of @polymorphi™A v—ri—˜les —re not ™ompletely knownF sn su™h ™—sesD the progr—m —lE ƒome of wv9s ™h—r—™teristi™s en—˜le ™ompilers to w—ys m—nipul—tes v—lues without inspe™ting their use interesting te™hniques th—t —re —ppli™—˜le to few intern—l represent—tionF fut in order to m—nipuE other l—ngu—gesF yn the other h—ndD m—ny —spe™ts l—te them @p—ss them —s —rgumentsD store them in of the l—ngu—ge —re ˜est —tt—™ked ˜y quite ™onvenE d—t— stru™turesD et™FA it is ne™ess—ry to know their tion—l te™hniquesF end there —re fe—tures of wv sizeF „he solution is to represent —ll polymorphi™ th—t might ˜e ™onsidered —n —nnoy—n™e @or — ’™h—lE v—ri—˜les ˜y ˜itEp—tterns of the s—me size @eFgFD one lenge4A ˜y ™ompiler writersY these —re des™ri˜ed in wordAF „hen polymorphism will workX —t run timeD se™tion RF polymorphi™ v—ri—˜les will ˜e p—ssed from one pl—™e to —nother ˜y m—™hine ™ode th—t is o˜livious of its —™tu—l typeF „his is ex—™tly the str—tegy used in imE ƒ—fety plementing vispX the ™ons fun™tion needs to know th—t the size of every o˜je™t is the s—meD ˜ut does gompilers for s—fe l—ngu—gesD in whi™h every ™omE not need to know the intern—l represent—tion of the pile—˜le progr—m h—s — wellEdened resultD ™—n perE o˜je™ts it is ™onsingF form ™ert—in tr—nsform—tions th—t ™ompilers for „his h—s ˜een interpreted to me—n th—t every uns—fe l—ngu—ges m—y notF por ex—mpleD if the v—ri—˜leD every fun™tion ™losureD —nd every —rguE progr—mmer ™—nnot —™™ess d—t— stru™tures ex™ept ment of — fun™tionD must ˜e represented in ex—™tly through the ’o™i—l4 oper—torsD then the ™ompiler one wordF ‡here the n—tur—l represent—tion of — is free to ™hoose —r˜itr—ry represent—tions|even difE v—lue does not t into one word @—s with — listD ferent represent—tions for the s—me d—t— stru™ture in — o—tingEpoint num˜erD et™FAD then — pointer to dierent p—rts of the s—me progr—mF sn —n uns—fe — he—pE—llo™—ted o˜je™t is used inste—dF „his is — l—ngu—geD the progr—mmer ™—n —™™ess the underlyE sour™e of gre—t ine™ien™yF ing ˜it p—ttern of — d—t— typeY this tends in pr—™ti™e €—r—metri™ polymorphism is — useful kind of —˜E @—nd ˜y ™onventionA to for™e the ™ompiler into preE str—™tionY —˜str—™tion often le—ds to ine™ien™yF di™t—˜le ™hoi™esF wv progr—mmers h—ve —lw—ys h—d to f—™e this enother ex—mple of the use of s—fety is given tr—deoD whi™h the l—ngu—ge h—s resolved in f—vor ˜elow under the he—ding ’e™™ur—te ™ontrol depenE of —˜str—™tionF fut perh—ps it is possi˜le to p—y den™eF4 issenti—llyD the input progr—m is the repE for the —˜str—™tion only where —˜str—™tion is —™tuE resent—tion of — ™omput—˜le progr—mD —nd the ™omE —lly usedF piler m—y use ’extension—l equ—lity4 to su˜stitute ˆ—vier veroy h—s re™ently pointed out th—t it —ny other represent—tion of the s—me fun™tionF yn is not ne™ess—ry to represent every v—ri—˜le in the other h—ndD in —n uns—fe l—ngu—geD some —spe™ts one wordD just polymorphi™ v—ri—˜les ‘PI“F „he of the progr—m ™—n ˜e represented only ˜y —n oper—E typeE™he™ker ™—n identify those pl—™es where nonE tion—l sem—nti™s spe™ifying — sequen™e of oper—tions polymorphi™ v—lues —re p—ssed to polymorphi™ v—riE whose order ™—nnot ˜e re—rr—ngedF —˜lesD —nd vi™e vers—F „hen the ™ompiler ™—n ™hoose

W spe™i—lized represent—tionsD just —s l—ngu—ges of — Xa p”FxY the elgol f—mily doD for nonpolymorphi™ v—ri—˜lesF f@xAY „henD to the extent th—t —n wv progr—m uses nonE ™ Xa p”FxY polymorphi™ v—ri—˜les @—s — €—s™—l progr—m doesAD we might like to repl—™e the st—tement ™ Xa p”FxD it will ˜e —s e™ient —s — €—s™—l progr—mF „his whi™h involves — fet™hD ˜y ™ Xa —D whi™h might ˜e ™ould ˜e — very signi™—nt s—vingsD —s veroy9s me—E — registerEregister moveF roweverD if there is — posE surements showF end it is — kind of optimiz—tion si˜ility th—t q points to the s—me re™ord —s pD @iFeFD th—t would ˜e impossi˜le in visp @˜e™—use the types is —li—sedAY or if f@xA might modify p”FxD then this ™—nnot ˜e s—fely —n—lyzed —t ™ompile timeAF tr—nsform—tion is inv—lidF st9s no e—sier to solve —li—sing pro˜lems in wv ƒep—r—tion of st—ti™ —nd dyn—mi™ seE th—n in —ny other l—ngu—geF roweverD they don9t m—nti™s need to ˜e solved3 pet™hes from immut—˜le o˜je™ts ™—nnot possi˜ly ˜e —e™ted ˜y —ny store instru™E sn —n wv ™ompiler the st—ti™ sem—nti™s @type ™he™kE tionsF end the v—st m—jority of o˜je™ts ™re—ted ingA —nd dyn—mi™ sem—nti™s @ev—lu—tionA ™—n ˜e —re immut—˜le @over WW7 in — v—riety of re—l —pE ev—lu—ted independently of e—™h otherD —nd in either pli™—tionsAF „husD most fet™hes ™—n ˜e moved p—st orderF sn — ™ompilerD dyn—mi™ sem—nti™s determines stores —nd pro™edure ™—llsD —nd ™ommon su˜expresE the m—™hine ™ode to ˜e gener—tedF sions involving fet™hes from immut—˜le o˜je™ts ™—n „his m—y h—ve interesting ™onsequen™es for the ˜e elimin—tedF st is very ple—s—nt to exploit this implement—tion of — sep—r—te ™ompil—tion f—™ilityF freedom in writing —n optimizing ™ompilerF st should ˜e possi˜le to gener—te m—™hine ™ode for — module in v—™uoY th—t isD without knowing the types of the module9s free identiersF „henD —t link time wut—˜le ™ells the module ™—n ˜e typeE™he™kedD sin™e the types sn wv the upd—te—˜le p—rts of d—t— stru™tures @ref of free identiers then ˜e™ome knownF ƒin™e ™ode ™ellsA —re identied —t ™ompile timeF „his ™ould ˜e gener—tion is mu™h more expensive th—n type ™he™kE useful to — g—r˜—ge ™olle™torF qener—tion—l g—r˜—ge ingD we might g—in signi™—nt ˜enet from this —pE ™olle™tors‘PRD RP“ segreg—te he—pE—llo™—ted re™ords pro—™hF „he —lgorithms for in v—™uo sep—r—te ™omE ˜y —geF fe™—use re™ords —re initi—lized @to point pil—tion h—ve ˜een worked out ‘QV“D —nd —re now to —lre—dyEexisting re™ordsA when they —re ™re—tedD ˜eing implementedF newer re™ords usu—lly point to older re™ordsF „he e more mund—ne —dv—nt—ge of the sep—r—tion of only w—y th—t —n older re™ord ™—n point to — newer st—ti™ —nd dyn—mi™ sem—nti™s is th—t — simpleD unE re™ord is ˜y —n upd—te to the older re™ord —fter the typed intermedi—te represent—tion ™—n ˜e usedY —nd newer one h—s ˜een ™re—tedF qener—tion—l ™olle™tors the tr—nsl—tion of wv into this intermedi—te repE need to e™iently identify —ll those ™ells in —n older resent—tion need not p—y —ttention to typesF „his gener—tion th—t h—ve ˜een upd—ted to point into — somewh—t simplies — ™ompilerF newer gener—tionF yf ™ourseD the represent—tion —n—lysis des™ri˜ed „here —re m—ny w—ys to keep tr—™k of upd—ted —˜ove m—kes the implement—tion of dyn—mi™ seE ™ellsF e softw—re —ppro—™h is to h—ve the ™ompiler m—nti™s dependent on st—ti™ sem—nti™sF ƒo — ™omE gener—te ™ode —fter e—™h —ssignment st—tement to piler th—t uses linkEtime type ™he™kingD or — simpler keep — list of —ll ™ells upd—ted ‘RP“F st9s not ne™E tr—nsl—tion to intermedi—te represent—tionD ™ould ess—ry to put newlyE—llo™—ted ™ells on this listD of not t—ke use represent—tion —n—lysisF ™ourseF ƒo —ll the ™ompiler needs to do is distinguish initi—lizing store instru™tions from upd—ting storesF smmut—˜le re™ords „his is e—sy to do in wvD —s it is in visp —nd —ny other l—ngu—ge where re™ords —re initi—lized —s they e ™ommon pro˜lem th—t pl—gues optimizing ™ompilE —re —llo™—tedF st is more di™ult in elgolElike l—nE ers is —li—singF st is often very di™ult to determine gu—ges where re™ords —re ™re—ted uniniti—lized —nd when two pointers point to the s—me thingY this inE —re then stored into —fterw—rds to initi—lize themF hi˜its ™ert—in kinds of optimizing tr—nsform—tionsF en —ltern—te —ppro—™h to upd—tes is to use the por ex—mple @in €—s™—lAX virtu—lEmemory h—rdw—re of the ™omputer ‘QW“F fy — Xa p”FxY m—king older gener—tions re—dEonlyD —n upd—ting q”Fx Xa ˜Y store will ™—use — p—ge f—ultF „his f—ult ™—n ˜e h—nE ™ Xa p”FxY dled ˜y m—king the p—ge write—˜leD —nd m—rking —ll orD simil—rlyD the o˜je™ts on th—t p—ge —s possi˜ly upd—tedF „hen

IH future upd—tes to the s—me o˜je™tD or to ne—r˜y o˜E m—™hineF „he p—ttern uXXv ensures th—t q is — ™ons je™tsD will not in™ur the ™ost of — f—ultF ™ellF sn ™—se @˜A it is ™le—rly permissi˜le to hoist the „he p—geE˜—sed te™hnique will work ˜est if there fet™hD sin™e the v—lidity of the pointer q ™—nnot ˜e is lo™—lity of referen™e —mong the upd—tesF st would —e™ted ˜y the v—lue of iF ˜e ˜estD for ex—mpleD to put —ll the mut—˜le o˜je™ts fut in ex—mple @™A we ™—nnot tell —nything —˜out ™lose to e—™h other on — sm—ll set of p—gesD so th—t the rel—tionship ˜etween j —nd pF „he progr—mmer fewer upd—ting p—ge f—ults o™™urF „his is possi˜le if might know th—t j is the length of the the runtime system ™—n guess whi™h o˜je™ts ™—n ˜e pD so th—t the fet™h ™—nnot ˜e hoistedY or the v—lue or will ˜e upd—tedF portun—telyD in wv the ref ™ells of j ™ould ˜e unrel—ted to whether p is nilD so the ™—n ˜e distinguished from immut—˜le re™ordsD d—t— fet™h ™—n ˜e hoistedF wv provides more pre™ise inE ™onstru™torsD —nd ™losuresD —s they —re ™re—tedF „he form—tion to the ™ompiler th—n g does —˜out the ™ompiler ™—n m—rk ref ™ells —s they —re —llo™—tedD true ™ontrolEdependen™es of fet™hesF or —llo™—te them in — dierent —re— of memoryD —nd sn summ—ryD the s—fety of the l—ngu—ge gives us — the runtime system ™—n rely on this m—rkingF ƒu™h tool for re—soning —™™ur—tely —˜out ™ontrol depenE — te™hnique is not possi˜le in vispD sin™e —ny o˜E den™iesF je™t ™—n in prin™iple ˜e upd—ted @even though few o˜je™ts —re —™tu—lly upd—ted in pr—™ti™eAF st is interesting to ™omp—re wv @whi™h —llows xo pointer equ—lity progr—mmers to exe™ute upd—ting side ee™tsA with €ointers in wv ™—nnot ˜e tested for identityF „h—t l—zy fun™tion—l l—ngu—ges su™h —s r—skell ‘IR“D from isD ex™ept for ref ™ellsD the progr—m ™—nnot deterE the g—r˜—ge ™olle™tor9s point of viewF ƒin™e genE mine if two simil—r o˜je™ts —re lo™—ted —t the s—me er—tion—l g—r˜—ge ™olle™tors h—te upd—tes to exE —ddressF ƒin™e nonEreferen™e o˜je™ts ™—nnot ˜e upE isting o˜je™tsD it would seem —t rst gl—n™e th—t d—tedD the progr—m ™—nnot even perform the exE — purely fun™tion—l l—ngu—ge with no —ssignment periment of modifying one o˜je™t —nd seeing if the st—tement would ˜e e—sier to g—r˜—geE™olle™tF fut other ™h—ngesF „his unusu—l fe—ture le—ds to sever—l l—zy l—ngu—ges —re ™onst—ntly upd—ting l—zy ™losures interesting ™onsequen™esF @’thunks4A with the results of ev—lu—ting themF gompilers ™—n perform ™ommon su˜expression €—r—doxi™—llyD from ™olle™tor9s viewpoint wv h—s elimin—tion on re™ord expressionsF „h—t isD in the m—ny fewer —ssignments th—n r—skellD —nd g—r˜—ge progr—m ™olle™tion in wv is likely to ˜e more e™ientF v—l t a @—D˜A e™™ur—te ™ontrol dependen™e v—l s a f@xA v—l u a @—D˜A e st—tement gu—rded ˜y — ™ondition—l is s—id to ˜e the l—st line ™—n ˜e implemented —s v—l u a t ˜y ™ontrol dependent on the ™ondition—lF roweverD this the ™ompilerF „his tr—nsform—tion would not work denition ™—n ˜e rened for s—fe l—ngu—ges su™h —s in vispD €—s™—lD or —lmost —ny other l—ngu—ge ˜eE wvF ™—use the progr—m would ˜e —˜le to test whether u gonsider these two wv fr—gments —nd — g fr—gE —nd t pointed to the s—me —ddressF mentX gompilers —nd g—r˜—geE™olle™tors ™—n do ’h—shE —A if ibH then ™—se q of uXXv ab u ™onsingF4 „h—t isD if the re™ord @—D˜A is to ˜e ™reE | nil ab FFF —tedD —nd — simil—r re™ord —lre—dy exists @—nd ™—n ˜e else FFF found using — spe™i—l h—sh t—˜leAD then — pointer to the existing re™ord is used inste—d of m—king — new ˜A ™—se q of uXXv ab if ibH then u oneF sn systems th—t —llow —ddress ™omp—risonsD else FFF h—shE™onsing would ent—il —n o˜serv—˜le sem—nti™ | nil ab FFF ™h—nge to the progr—mY in wv it would notF xowD h—shE™onsing m—y ˜e intoler—˜ly slowF fut ™onsider ™A if @ibHA if @jbHA s a pEblinkY — v—ri—tion in whi™h — gener—tion—l g—r˜—ge ™olle™tor sn e—™h ™—se there is — fet™h gu—rded ˜y — two ™ondiE does h—shEmerging of o˜je™ts th—t survive into the tion—lsF „he ™ompiler might wish to hoist the fet™h se™ond gener—tionF „hen it9s only ne™ess—ry to h—sh —˜ove the inner ™ondition—lD perh—ps to improve inE — very sm—ll per™ent—ge of the o˜je™ts th—t get —lloE stru™tion s™heduling or register —llo™—tionF ™—ted @sin™e only — few o˜je™ts survive — g—r˜—ge sn ™—se @—A this is impermissi˜leD sin™e q might ˜e ™olle™tionAF „his ide— h—s ˜een implemented ˜y nil|— fet™h from nil might ˜e illeg—l on the t—rget w—r™elo qon$™—lves —t €rin™eton niversityF

II q—r˜—ge ™olle™tors like to move —n o˜je™t from registers to invoke — new thre—d|—re —ll ne—tly enE one pl—™e to —notherY ˜ut then they need to upd—te ™—psul—ted in the ™ontinu—tion me™h—nismF —ll the pointers to the o˜je™tF e ™on™urrent g—r˜—ge „hre—d s™heduling is mu™h more e™ient when ™olle™tor might h—ve trou˜le nding —ll these pointE done in the ™lient pro™essD without requiring ers qui™klyF sn th—t ™—seD it might ˜e desire—˜le to h—rdw—reE —nd oper—tingEsystem ™ontext swit™hes h—ve two us—˜le ™opies of the o˜je™t|old —nd new| when syn™hronizing or interle—ving thre—d exe™uE until —ll the pointers ™—n ˜e ’forw—rded4 ‘QQ“F tionsF ‚e™ent oper—tingEsystem rese—r™h ‘P“ h—s histri˜uted systems ™—n ™opy o˜je™ts without shown how to let the oper—ting system s™hedule proE worrying —˜out identityF ƒuppose we w—nt to m—ke ™essors while the ™lient progr—ms m—n—ge pro™esses the distri˜uted n—ture of — system tr—nsp—rent to to t—ke —dv—nt—ge of the e™ien™y of userEmode the progr—mmerF sf sever—l pro™essors w—nt to look s™hedulersF sn wv extended with rstE™l—ss ™ontinE —t — d—t— stru™ture —t the s—me timeD to o˜t—in —dE u—tionsD the s™heduler ™—n ˜e — sour™eEl—ngu—ge proE equ—te perform—n™e it is ne™ess—ry to ™opy pie™es gr—m th—t m—nipul—tes ™ontinu—tions dire™tlyF „his of the d—t— stru™ture onto the dierent pro™essorsF —ppro—™h is very eleg—nt —nd ro˜ustD —nd h—s proved ‡ith — ™onvention—l progr—mming l—ngu—ge we now su™™essful in gon™urrent wv ‘QS“ —nd wvE„hre—ds h—ve to worry —˜out —ddress identity —nd m—kE ‘W“D two quite dierent ™on™urrent progr—mming enE ing upd—tes visi˜le to —ll the pro™essorsF „hese vironments for wvF pro˜lems —re usu—lly solved in h—rdw—re @eFgFD with snoopy ™—™hesAF sn wvD worries —˜out upd—tes disE —ppe—r for —ll ˜ut referen™e v—luesD whi™h —re r—re Q wv tr—ps —nd pitf—lls enough th—t ™onvention—l syn™hroniz—tion —nd mesE s—ge p—ssing would ˜e —dequ—tely e™ientF „he synt—™ti™ —nd sem—nti™ pitf—lls th—t —n wv proE gr—mmer en™ounters —re mu™h less severe —nd less numerous th—n those des™ri˜ed in l—ngu—ges su™h —s „he module system g ‘PH“D whi™h is —n egregious ex—mpleF

‚unEtime —spe™ts of the module system turn out to ˜e very simple ‘S“F e stru™ture th—t exports n wisspelled ™onstru™tors types —nd m v—lues ™—n ˜e implemented —s —n orE e wellEknown —nd most d—ngerous pitf—ll —w—iting din—ry mEtuple @types —re needed only —t ™ompile the wv progr—mmer is the misspelling of — ™onst—nt timeAF pun™tors ™—n ˜e implemented —s fun™tions d—t— ™onstru™tor in — p—tternF fe™—use there is no th—t t—ke stru™tures @tuplesA —s —rguments —nd reE synt—™ti™ distin™tion ˜etween ™onstru™tors —nd v—riE turn stru™tures —s resultsF ƒin™e —ll interEmodule —˜lesD —ny identier de™l—red —s — ™onstru™tor is unE link—ge ™—n ˜e expressed this w—yD — ™onvention—l derstood ˜y the ™ompiler —s — ™onstru™torD —nd —ny linkElo—der is not even ne™ess—ry|whi™h is p—rti™E other identier is interpreted —s — v—ri—˜le @whi™h ul—rly ™onvenient in —n inter—™tive system th—t ™—n m—t™hes —nythingAF „husD — misspelled ™onstru™tor lo—d —nd exe™ute progr—ms —nd modules on the yF looks like — v—ri—˜leD —nd is —™™epted ˜y the ™omE pilerF por ex—mpleD the misspelling of nil in this implement—tion of length ™—uses the fun™tion —lE pirstE™l—ss ™ontinu—tions w—ys to return zeroX e very interesting —nd powerful fe—ture of fun length @nillA a H ƒ™heme‘QR“ is the ™—llEwithE™urrentE™ontinu—tion | length @he—dXXrestA a I C length rest me™h—nismD where˜y the dyn—mi™ ™—lling ™ontext sn m—ny ™—ses @—s in this oneAD the p—tternEm—t™h of — fun™tion ™—n ˜e —˜str—™ted —s —nother fun™E will h—ve redund—nt rules —s — result of the progr—mE tionF ƒt—nd—rd wv does not h—ve su™h rstE™l—ss mer9s mist—keF ƒin™e the ™ompiler w—rns —˜out reE ™ontinu—tionsY ˜ut it turns out th—t they ™—n e—sily dund—nt rulesD perh—ps the error ™—n ˜e dete™ted ˜e introdu™edD —nd they t very ni™ely into the wv th—t w—yF fut not in —ll ™—sesF end w—rning mesE type system‘II“F s—ges —re e—sily ignored ˜y the progr—mmerF pirstE™l—ss ™ontinu—tions m—ke it e—sy to impleE „he —ppro—™h €rolog t—kes to solve the s—me ment ™oroutinesD or their gener—liz—tionD lightweight pro˜lem is to m—ke ™onstru™tors synt—™ti™—lly difE pro™esses ‘RS“F vowElevel det—ils th—t must ordin—rE ferent from v—ri—˜lesX €rolog ™onstru™tors ˜egin ily ˜e ™onfronted in su™h implement—tions|su™h —s with lowerE™—seD v—ri—˜les with upperE™—seF „he the —llo™—tion of new —™tiv—tion st—™ksD the g—r˜—geE s—me solution would not quite work in wvD for two ™olle™tor interf—™eD —nd the me™h—nisms for s—ving re—sonsX wv —llows ’sym˜oli™4 identiers su™h —s

IP XX —nd C th—t don9t ˜egin with — letter @—nd for fut it9s — frequent —nnoy—n™eY when writing — proE whi™h —n upperGlowerE™—se rule wouldn9t —pplyAY gr—m on the integers s —m just not thinking —˜out —nd wv —llows d—t—E™onstru™tors to ˜e ’thinned4 re—l num˜ersD —nd s —m ™onst—ntly surprised to see to identi™—llyEn—med v—lue ˜indings —t module inE the overlo—dingEresolution f—iluresF end in te—™hE terf—™esD so th—t wh—t is seen —s — ™onstru™tor in ing the l—ngu—geD s must —lw—ys qu—lify st—tements one module is seen —s — fun™tion @v—ri—˜leA in —nE su™h —s ’„he wv type inferen™e —lgorithm ™—n —lE other moduleF „hese —re ˜oth sm—ll thingsY they —re w—ys derive — mostEgener—l type for —ny expression4 ™ute ˜ut minim—lly usefulD —nd progr—mmers ™ould with te™hni™—lities —˜out — h—lfEdozen ˜uiltEin operE e—sily work —round their —˜sen™eF —torsF ƒome v—ri—tion of the €rolog —ppro—™h would yne w—y to solve this pro˜lem is to —llow runEtime solve this pro˜lem without signi™—ntly —ltering the resolution of overlo—dingD —s in the l—ngu—ge r—skell n—ture of ƒt—nd—rd wvF „he r—skell l—ngu—ge ‘IR“ ‘RRD IS“ —nd in other extensions of typed l—m˜d— uses su™h —n —ppro—™hF ™—l™ulus ‘IV“F sn these l—ngu—gesD ™l—ss oper—tors —re p—ssed @—t runtimeA —s impli™it extr— —rguments to fun™tions th—t t—ke polymorphi™ overlo—ded types yverlo—ding —s —rgumentsF wost l—ngu—ges support some kind of overlo—ding of fut this me™h—nism m—kes dyn—mi™ sem—nti™s oper—torsD —lso known —s —d ho™ polymorphismF sn dependent on st—ti™ sem—nti™sD whi™h pre™ludes ™erE its simplest formD this me—ns th—t —n oper—tor su™h t—in kinds of sep—r—te ™ompil—tion s™hemesF end —s C ™—n ˜e —pplied to integer —rguments @yielding r—skell uses — r—ther he—vyweight me™h—nism for —n integer resultA or to re—l —rguments @yielding — —n —pp—rently sm—ll g—inF efter —llD m—king do with re—l resultAF „his is not the s—me —s the p—r—metri™ nonEoverlo—ded identiers wouldn9t m—ke progr—ms polymorphism of wv or visp fun™tions su™h —s ™ons —ny ˜igger|one would just h—ve to m—ke up dierE or m—pX „he —lgorithm used to implement C is difE ent n—mes for dierent oper—tionsF ferent for integers —nd re—lsD ˜ut the implement—tion s —m often —sked whether s seriously me—n th—t of ™ons is the s—me for —ll typesF o—ting point —ddition should not ˜e represented v—ngu—ges of the elgol —nd fg€v f—milies h—ve ˜y the C sym˜olF „h—t is ex—™tly wh—t s me—nX —lw—ys h—d overlo—ded oper—tors ˜uilt inD with overE ƒt—nd—rd wv provides only — h—lfEdozen overlo—ded lo—ding resolution @the determin—tion of —rgument oper—tors —nyw—yD —nd the use of C– or some su™h typesD —nd therefore of wh—t implement—tion fun™E —dmittedly ugly sym˜ol would ˜e — re—son—˜le pri™e tion to useA —t ™ompileEtimeF v—ngu—ges of the to p—y for the deletion of overlo—ding from the l—nE ’m—them—ti™—l4 f—mily h—ve typi™—lly h—d overlo—dE gu—geF „he designers of ƒt—nd—rd wv ™onsidered ing resolution —t runEtimeF the pro˜lem ™—refully —nd ™—me to the opposite ƒever—l l—ngu—ges in —ll three f—milies h—ve —lE ™on™lusion|so it must ˜e — m—tter of t—steF lowed progr—mmers to dene new overlo—ded idenE tiersD —nd to spe™ify the implement—tion fun™tion ‡e—k type v—ri—˜les to use for e—™h —rgument typeF y˜je™tEoriented l—nE gu—gesD espe™i—llyD h—ve sophisti™—ted support for „he wv type systemD —nd type inferen™e —lgorithmD userEdened overlo—dingF works very ee™tively on progr—ms without side efE gompileEtime overlo—ding resolution —nd wvE fe™tsF €—rti™ul—rly import—nt is th—t the types —re style polymorphi™ type inferen™e do not work well ’intuitiveX4 the inferred types seem very n—tur—l together ‘IH“F sn pro™essing — fun™tion denition —nd o˜vious to most progr—mmers in most ™—sesF su™h —s st h—s long ˜een known th—t this —lgorithm does not work for polymorphi™ referen™esF „o illustr—te fun dou˜le@xA a xCx with —n oftEused ex—mpleD ™onsider it is impossi˜le to know —t ™ompileEtime whether let v—l f a fn xabx in f IY f true end C is to ˜e implemented —s integer or o—tingEpoint „he fun™tion f h—s the type VX  3 D —nd ™—n —dditionF ™orre™tly ˜e —pplied to —n int —nd — ˜oolF „his is not — d—ngerous ’tr—p4 for the progr—mE fut let f ˜e — referen™e to — polymorphi™ fun™tion merD sin™e —ny —m˜iguous fun™tion su™h —s dou˜le —nd the type inferen™e —lgorithm ™—nnot ˜e n—ively will ˜e ™—ught —t ™ompileEtime —s — typeE™he™king —ppliedF st seems n—tur—l to give polymorphi™ types errorY the progr—mmer will x the pro˜lem @preE to the refD XaD —nd 3 oper—torsX sum—˜lyA ˜y inserting — type ™onstr—intD eFgF fun dou˜le @xX re—lA a xCx ref X VX  3 @ ref A

IQ Xa X VX @ ref  A 3 unit whi™h is given — list of p—irsY the rst element of 3 X VX  ref 3  e—™h p—ir is —n integer key —nd the se™ond element is of —r˜itr—ry type @thoughD of ™ourseD the s—me type xow try to typeE™he™k the expression for e—™h element of the listAF „he sort fun™tion returns the list sorted ˜y keyF st is e—sy to write — let v—l f a ref@fn xabxA purely fun™tion—l qui™ksort or to solve in f Xa @fn xabxCIAY this pro˜lem e™ientlyF @3fA true fut suppose one expe™ts —ll the integers to ˜e in end the r—nge I{IHHHD —nd the list ™ont—in thous—nds sf f h—d type VX @@ 3 Aref AD then the progr—m of elementsF „hen — ˜u™ket sort is f—sterD using —n would @in—ppropri—telyA typeE™he™kD —nd would ’go —rr—y of IHHH elementsF fut even though the —rr—y wrong4 —t run time ˜y in™rementing — ˜oole—nF ƒo is not returned from sortD or ret—ined w—y —fter the n—ive polymorphi™ type ™he™ker h—s proved inE sort returnsD the type of this ˜u™ketEsort progr—m —dequ—te to h—ndle referen™e ™ellsF e more —pproE would now ˜e pri—te type for f might ˜e @VX  3 Aref AD with the sortX @int B 9•—A list Eb @int B 9•—A list qu—ntier nested inside the ref ™onstru™torY ˜ut the indi™—ting th—t the nonEkey elements of the list ™—nE wv type inferen™e system ™—nnot ™ope with ’inner4 not ˜e polymorphi™ v—luesF st is too ˜—d th—t this qu—ntiersF purely intern—l d—t— stru™ture must ˜e ’mentioned4 g—rdelli9s wv ™ompiler ‘U“D —nd the initi—l proE in the interf—™eF pos—l for ƒt—nd—rd wv ‘PW“D required th—t referen™e w—ny rese—r™hers h—ve re™ently ˜een eng—ged in ™ells ˜e ™ompletely monomorphi™Y th—t isD the ™omE devising ˜etter type inferen™e systems for polymorE piler must ˜e —˜le to infer — type without type v—riE phi™ progr—ms with referen™es‘PSD PQD IUD RHD RV“D —˜les for —ny —rgument of the ref ™onstru™torF „his whi™h indi™—tes th—t the pro˜lem of typeE™he™king is ™ert—inly s—feD ˜ut insu™iently exi˜leF „ofte‘RI“ referen™es is not yet reg—rded —s ’solvedY4 some of gener—lized this ide—D introdu™ing ’we—kly polymorE these systems —ddress the pro˜lem of intern—lD temE phi™4 referen™es —nd ’imper—tive typesF4 „hese —lE por—ry referen™es des™ri˜ed —˜oveF low — fun™tion th—t ™re—tes referen™es to ˜e —pplied to more th—n one typeD —s long —s e—™h su™h type is itself monomorphi™F „ofte9s imper—tive types —re „he wv qr—mm—r — su˜st—nti—l improvementD —nd m—ke for — us—˜le „he designers of ƒt—nd—rd wv worked very h—rd l—ngu—geY they h—ve ˜een —dopted —s p—rt of the to get the sem—nti™s rightD —nd to dene the seE ƒt—nd—rd wv henitionF m—nti™s —s ™ompletely —nd —s form—lly —s possi˜leF roweverD „ofte9s s™heme ™—n ˜e m—de more exiE nfortun—telyD the s—me —ttention w—s not p—id to ˜leF sn p—rti™ul—rD it does not seem to work very n—tE synt—xF „hirty ye—rs —fter elgolD —nd fteen ye—rs ur—lly with higherEorder fun™tionsY ™urrying — fun™E —fter ‰—™™D „he henition of ƒt—nd—rd wv does not tion of imper—tive type ™—n le—d to — fun™tion th—t ™ont—in —n un—m˜iguous ™ontextEfree gr—mm—r for is reje™ted ˜y „ofte9s —lgorithmF w—™ueen solved the synt—x of the l—ngu—geF this pro˜lem ˜y —ssigning numeri™—l we—kness inE es presentedD the gr—mm—r is —m˜iguous for two di™es to the type v—ri—˜les‘PU“F w—™ueen9s s™heme re—sonsX „he p—rser must ’guess4 whether —n idenE is stri™tly more powerful th—n „ofte9sD —nd h—s ˜een tier in — p—ttern is — v—ri—˜le or — ™onstru™torY —nd implemented in ƒt—nd—rd wv of xew terseyF it must ’guess4 whether —n identier is dened —s roweverD w—™ueen9s we—k types —ren9t very infixD —nd if soD —t wh—t pre™eden™e —nd —sso™i—E e—sy for progr—mmers to underst—ndF st9s di™ult tivityF for the uniniti—ted to infer types for fun™tions th—t „hese pro˜lems —re not very di™ult to solve seE m—ke ref ™ellsY typi™—lly s write the expression —nd m—nti™—llyF por ex—mpleD one might think the exE get the ™ompiler to print out the typeD whi™h s ™—n pression — ˜ ™ d e f h—s to ˜e p—rsed very dierE then use in writing module sign—turesD et™F „his ently if ˜ is —n inx oper—tor th—n if ™ isF „he soluE —ppro—™h to interf—™e design is the opposite of th—t tion is to p—rse su™h —n expression —s — sequen™e of usu—lly re™ommended3 —tomsD —nd implement — simple pre™eden™e p—rser „he most —nnoying thing —˜out „ofte9s —nd @QU lines of ™ode in ƒwvGxtA —s — ’sem—nti™ —™tion4 w—™ueen9s imper—tive types is the ’visi˜ility4 for inx oper—torsF of lo™—llyEused referen™es in interf—™e des™riptionsF ƒo the pro˜lem is not th—t wv h—s no ™ontextEfree gonsider — fun™tion gr—mm—rY it9s th—t the gr—mm—r is not ™le—rly spe™E sortX @int B 9—A list Eb @int B 9—A list ied in the henitionF yne immedi—tely runs into

IR pro˜lems when one w—nts to implement — p—rser ™olons option—l —fter de™l—r—tionsF „husD the de™l—E for wvF e good l—ngu—ge denition should in™lude r—tion — ™omplete v‚@IA gr—mm—r with no redu™eGredu™e v—l — a SY ™oni™ts —nd —s few shiftGredu™e ™oni™ts —s posE v—l ˜ a TY si˜leF iven if the implementor intends to p—rse would h—ve the s—me me—ning without the using — dierent str—tegy @eFgFD vv@IA or re™ursive semi™olonsFIH des™entAD the v‚@IA gr—mm—r is — useful st—rting „his is — good thingY s9d r—ther not h—ve semiE pointF „he ƒt—nd—rd wv of xew tersey implemenE ™olons ™luttering up my progr—ms @my prose is —nE t—tion ‘T“ uses su™h — gr—mm—r @with TV termin—lsD other m—tterAF fut it turns out th—t ˜etween — UT nontermin—lsD PQI produ™tionsD RSP vev‚@IA stru™ture de™l—r—tion —nd — fun™tor de™l—r—tion st—tesAF — semi™olon is required @though not ˜etween two wost l—ngu—ges h—ve — shiftGredu™e ™oni™t with stru™ture de™l—r—tions or two fun™torsAF „he elseF sn the expression only —pp—rent re—son for this dis™rep—n™y is th—t if e then if f then g else h the synt—x of module de™l—r—tions w—s not ™—refully it9s not ™le—r whether the else is supposed to m—t™h thought outF the rst then or the se™ondF „his is ™ustom—rily pin—llyD s will rem—rk th—t s h—ve he—rd from resolved ˜y s—ying th—t the innermost @in this ™—seD m—ny dierent people th—t they nd wv synt—x the se™ondA then is m—t™hedY th—t isD —n v‚ p—rser ™onfusingD uglyD —nd di™ult to le—rnF es — longE should resolve the ™oni™t ˜y shiftingF time wv progr—mmerD s —m quite ™omfort—˜le with wv ™leverly —voids this pro˜lem ˜y requiring th—t wv synt—xY ˜ut perh—ps the frequen™y of these ™omE every if h—ve ˜oth — then —nd —n else ™l—useF fut pl—ints might serve —s — hint th—t there is —n opporE — simil—r pro˜lem o™™urs in ™—se expressionsX tunity for — synt—x designer of r—re t—ste —nd geniusF ™—se e of ˆ ab ™—se f snx oper—tors of ‰ ab g |  ab h €rogr—mmers m—y dene new inx oper—tors in xowD is the  p—ttern p—rt of ™—se e or ™—se fc ƒt—nd—rd wvD —nd m—y give them — pre™eden™e „he henition s—ys th—t it9s the l—tterY —nd this @˜etween H —nd WD where — higher num˜er indiE ™orresponds to resolving — shiftGredu™e ™oni™t in ™—tes tighter ˜indingA —nd left or right —sso™i—tivityF f—vor of the shiftF „his is the only shiftGredu™e ™onE sf the progr—mmer w—nts to dene —n exponenti—E i™t in the ƒt—nd—rd wv of xew tersey gr—mm—rF tion oper—tor BB —nd m—ke it rightE—sso™i—tive —nd €rogr—mmers h—ve grown —™™ustomed to the ˜eE tighterE˜inding th—n multipli™—tionD the de™l—r—tion h—vior of ifEthenEelseF fut —s —n wv progr—mE infixr V BB works quite wellF mer s often f—ll into the ™—se tr—pX s often write „he henition st—tes p—tternEm—t™hes like the one —˜oveF „he solution is to en™lose the inner ™—se expression in p—renthesesD infix —nd infixr di™t—te left —nd right ˜ut s would r—ther the pro˜lem didn9t o™™ur in the —sso™i—tivity respe™tivelyY —sso™i—tion is —lE rst pl—™eF w—ys to the left for dierent oper—tors of „hese extr— p—rentheses —re uglyF sn f—™tD h—ving the s—me pre™eden™eF — shiftGredu™e ™oni™t in the gr—mm—r is uglyF e „his is not —s good — rule —s it ™ould ˜eF gonsider ˜etter solution might ˜e to require th—t ™—se —nd the listElike d—t—type fn expressions end with endD so the ex—mple —˜ove d—t—type 9— listP a xsv would ˜e writtenX | 66 of 9— B 9— listP ™—se e | 88 of 9— B 9— listP of ˆ ab ™—se f infixr S 66 88 of ‰ ab g rere there —re two —vors of ™ons ™ellsF „hen the end expression |  ab h end I 66 P 66 Q 88 R 66 xsv xow there is no —m˜iguityF st isD howeverD — m—tter is intended to ˜e — ’listP4 of integersD some of whi™h of t—ste whether the end is uglier th—n the extr— —re m—rked with 66 —nd others with 88D just —s p—renthesesF IXXPXXQXXRXXnil is —n ordin—ry list of integersF „here —re some other synt—™ti™ glit™hesF st w—s IH„he wv ’top level4 @re—dEev—lEprint loopA —dds some ™le—rly the intent of the designers to m—ke semiE twists of its ownY these —re dis™ussed elsewhere in the p—perF

IS sn ˜oth ™—sesD the ™ons oper—tors @XXD 66D 88A —re —ll de™l—r—tions impli™itly introdu™ed ˜y openD not me—nt to —sso™i—te to the rightF fut the wv hefE just xity de™l—r—tionsF „he sem—nti™s @iFeFD typeD inition requires th—t the ’listP4 expression —˜ove v—lueD et™FA of —n oper—tor ™—n9t ˜e determined lexE should —sso™i—te to the left ˜e™—use dierent operE i™—lly ˜e™—use of the use of openY the progr—mmer —tors of the s—me pre™eden™e —re usedF €erh—ps who ™—n p—rse the oper—tors ˜ut doesn9t know wh—t the henition ’me—nt4 to s—y th—t ’oper—tors of they do is —lmost —s ˜—dly o —s the one who isn9t the s—me pre™eden™e ˜ut opposite —sso™i—tivity —ssoE sure —˜out oper—tor pre™eden™eF ™i—te to the leftF4 fut —n even ˜etter rule would ˜e „he henition ‘QID p—ge IH“ st—tes th—t ’— th—t leftE —nd rightE—sso™i—tive oper—tors of the s—me more li˜er—l s™heme @whi™h is under ™onsider—tionA4 pre™eden™e don9t mix without p—renthesesY this is would —llow inx spe™s in sign—turesD —nd then —n the rule in r—skell ‘IR“F open de™l—r—tion would reEinst—ll xities of oper—E torsF ƒu™h — s™heme h—s ˜een implemented in ƒt—nE snx vsF wodules d—rd wv of xew tersey‘T“D —nd is quite ™onvenient to useF snx de™l—r—tions —re not exported from modulesD —nd ™—nnot ˜e spe™ied in sign—turesF „his m—kes them signi™—ntly less usefulF por ex—mpleD if one implements — module †e™tor ƒep—r—te ™ompil—tion to implement r—ndomE—™™essD integerEkeyed t—˜lesD one might w—nt — sign—ture like „he wv l—ngu—ge denition is purposely quite sign—ture †ig„y‚ a v—gue —˜out the pr—gm—ti™s of putting progr—ms toE sig type 9— ve™tor getherF „he henition ™hooses to pretend th—t —ll v—l ve™torX 9— list Eb 9— ve™tor progr—ms —re typed into —n inter—™tive ’top level4 v—l su˜X 9— ve™tor B int Eb 9— re—dEev—lEprint loopD —nd v—guely —lludes to the f—™t end th—t progr—ms might ˜e ™ompiled from lesFII stru™ture †e™torX †ig„y‚ a F F F „his is re—son—˜leX there is nothing wrong with yne might then w—nt to m—ke su˜ —n inx oper—torD dening — progr—mming l—ngu—ge in the —˜str—™tD so th—t expressions like † su˜ i ™ould ˜e used for without tying it to the ™on™rete det—ils of oper—ting getting the ith element of — ve™torF systems —nd le systemsF st is f—r ˜etter to unE „o use ve™tors in —nother module fD one ™ould derspe™ify this —spe™t of — l—ngu—ge th—n to get it refer to the ve™torE™re—tion fun™tion †e™torFve™tor wrongF —nd the su˜s™ript fun™tion †e™torFsu˜F fut it is roweverD modern l—ngu—ges with module f—™ilE more ™onvenient to write open †e™tor inside fD so ities @in™luding gD wodul—D ed—A usu—lly spe™ify th—t ve™tor —nd su˜ ™—n ˜e used without prex quite ™le—rly whi™h p—rts of — progr—m ™—n ˜e ™omE within fF piled sep—r—tely from the rest of the progr—mX in gD roweverD one ™—nnot write infix su˜ in the sigE — F™ le gener—lly requires some Fh les for ™omE n—ture †ig„y‚Y within f the su˜ oper—tor won9t ˜e pil—tionD ˜ut not other F™ les‘IW“Y the wodul—EP inx unless there is — sep—r—te infix su˜ de™l—r—E denition‘RU“ is even more spe™i™ —˜out the org—E tion in fF niz—tion of ™ompil—tion unitsF „he ide— ˜ehind the module system is th—t —n —r˜itr—ry pie™e of st—ti™ environment ™—n ˜e ’enE ƒin™e wv h—s — r—ther el—˜or—te module systemD ™—psul—tedY4 then open will re™onstitute th—t enE it would seem th—t e—™h module should ˜e — sep—E vironment in —nother s™opeF fy prohi˜iting this r—tely ™ompile—˜le unitF fut this is not ne™ess—rily en™—psul—tion of the ’xity4 portion of the st—ti™ the ™—seY stru™tures with free stru™ture identiers environmentD the henition m—kes infix de™l—r—E do not su™iently spe™ify wh—t they —re importE tions se™ondE™l—ssF ingF „he gomment—ry suggests some @severeA reE „he only good —rgument —g—inst —llowing open stri™tions on the module system th—t would —llow to re™onstitute xity de™l—r—tions is th—t it might sep—r—te ™ompil—tionF fut on the wholeD the rel—E m—ke progr—ms h—rd to underst—ndY the interpreE tionship ˜etween stru™turesD modulesD —nd sep—r—te t—tion @iFeFD xityA of —n oper—tor ™—nnot ˜e underE ™ompil—tion ™ould use some further workF stood ˜y looking lexi™—lly upw—rds in the text of the progr—m for — de™l—r—tion of th—t identierD ˜e™—use IIsn f—™tD most implement—tions h—ve — fun™tion ™—lled use one might not noti™e the open of — module identiE th—t —llows les to ˜e ™ompiledY ˜ut they dis—gree on the er @eFgFD †e™torAF fut this —rgument —pplies to sem—nti™s of nested usesF

IT e˜str—™t stru™tures open in sign—tures ‡hen — stru™ture denition in wv is ™onstr—ined st is ™ustom—ryD in writing modul—r softw—reD to ˜y — sign—tureD the represent—tions of types —re not spe™ify the interf—™es ˜etween modules —nd to imE hiddenY they ’show throughF4 „husD the de™l—r—tion plement the modules to meet those interf—™esF iven of — module implementing ™omplex num˜ersD when the progr—mmer develops the implement—tion sign—ture gyw€viˆ a rstD it is good pr—™ti™e to pretend otherwise ˜y sig type ™omplex writing the interf—™e sign—ture —nd ™le—ning up the v—l B X ™omplexB™omplex Eb ™omplex implement—tion —s ne™ess—ry to meet the sign—tureF end „hen the re—der of the progr—m ™—n rst underE st—nd the interf—™es @whi™h —re gener—lly more ™onE stru™ture gomplex X gyw€viˆ a ™ise th—n the implement—tionsAD —nd then pro™eed to stru™t le—rn —˜out the implement—tion of one module —t — type ™omplex a re—l B re—l timeF „he sign—tures of the ƒt—nd—rd wv module v—l op B a fn @@rIDthet—IAX™omplexD system support the writing of ™le—r interf—™e spe™iE @rPDthet—PAX™omplexA ab ™—tionsF @rIBrPD thet—ICthet—PA xow im—gine —n interf—™e denition th—t s—ysD end in ee™tD ’the sign—ture ƒ is dened to ˜e wh—tE does not hide the f—™t th—t the pol—r represent—tion ever interf—™e h—ppens to ˜e met ˜y the implemenE is usedX stru™ture de™l—r—tionsD even when ™onE t—tion module wF4 „hen to underst—nd ƒD one str—ined ˜y sign—turesD —llow type —nd sh—ring inE must re—d through the entire implement—tion wD form—tion to ’show through4 the ™onstr—intF yther inferring types for —ll the v—luesD keeping tr—™k of modules th—t m—ke use of the gomplex stru™ture whi™h identiers —re visi˜le in the outermost s™opeF will ˜e —˜le to —™™ess the ™omponents of — ™omplex e rightEthinking softw—re engineer should ™ert—inly num˜erD unless they import gomplex —s the p—r—mE frown —t su™h — method of dening interf—™esF eter of — fun™torF s h—ve found th—t most people fut this is ex—™tly wh—t is provided ˜y open spe™s le—rning wv —re surprised ˜y thisD ˜e™—use the sigE in sign—tures3 „he sign—ture n—ture de™l—r—tion itself m—kes no mention of the sign—ture ƒ a sig open w end represent—tionF spe™ies th—t the interf—™e ƒ is just wh—tever sn some ™—ses the tr—nsp—ren™y of sign—tures is @l—rgestA interf—™e is o˜t—ined ˜y el—˜or—ting the ne™ess—ry —nd usefulY ˜ut in m—ny ™—ses it would stru™ture wF ˜e useful to use the module system to implement „he open spe™ m—y ˜e ple—singly symmetri™—l —˜str—™t d—t— typesF w—™ueen9s origin—l module to the theoreti™i—nY it m—y ˜e te™hni™—lly useful in propos—l‘PT“ provided for —˜str—™tionD — spe™i—l dening the sem—nti™s of the rest of the module sysE kind of stru™ture de™l—r—tion in whi™h —ll type repE temF fut it h—s no pl—™e in — re—l progr—mming resent—tion —nd sh—ring inform—tion not spe™ied l—ngu—geFIP in the sign—ture ™onstr—int would ˜e hiddenF qivE e rel—ted pro˜lem h—s to do with overl—pE ing progr—mmers the ™hoi™e ˜etween stru™ture —nd ping open @or in™ludeA spe™sF ƒin™e open w or —˜str—™tion would ˜etter support progr—mming in™lude ƒ h—s the ee™t of in™luding m—ny identiE with —˜str—™t d—t— typesF e˜str—™t d—t—types with ersD it is e—sy for the progr—mmer to in—dvert—ntly hidden represent—tions —re the —pple pie —nd mothE @or even purposefullyA in™lude two dierent sign—E erhood of modern softw—re engineeringD —nd rightly tures ™ont—ining the s—me typeD v—lueD or stru™ture soF identierF „hough there is no —m˜iguity in the seE yf ™ourseD there exist other me™h—nisms for m—nti™s @the l—ter spe™ t—kes pre™eden™eAD multiple —˜str—™t d—t— types in ƒt—nd—rd wv @—˜stype denitions m—ke the s™ope of spe™s mu™h more ™omE —nd fun™torAF fut it is p—rti™ul—rly ™onvenient pli™—ted to followD —nd m—ke the implement—tion of to use —˜str—™t d—t— types —t the module levelD sem—nti™ —n—lysis for sign—tures —nd sh—ring mu™h where —˜str—™tion is more str—ightforw—rd th—n more di™ultF —˜stypeF end fun™tors ™—n ˜e — ™lumsy me™h—nism „he s™ope rules for wv expressionsD while simE for stru™turing progr—msF pleD —re not ™ompletely trivi—lY —nd th—t is —ppropriE „he gomment—ry to the denition shows th—t —teX progr—ms —re ™ompli™—ted thingsF fut it seems —˜str—™tion is not sem—nti™—lly pro˜lem—ti™—l ‘QHD IP p—ge VS“D —nd even gives — useful gener—liz—tion of e sh—ring ™onstr—int ™—n —lso rel—te — sign—ture interf—™e to — free stru™tureF fut this is not so pro˜lem—ti™—l for the w—™ueen9s propos—lF st9s — pity th—t this fe—ture re—der of the progr—mD sin™e it h—s no ee™t on the visi˜ility w—s omitted from the henitionF of n—mesF

IU worthwhile to strive for extreme simpli™ity in interE st—ti™ @lexi™—lA s™opeD st—ti™—llyE™he™ked modulesF f—™e @sign—tureA denitionsX s™ope rules for sign—E roweverD some —spe™ts of the l—ngu—ge design —re tures should ˜e trivi—lF e ™le—r underst—nding of the h—rd to ™ompile e™ientlyF interf—™es of — progr—m is — prerequisite to underE st—nding the progr—mF ‚emoving openD lo™—lD —nd €olymorphi™ equ—lity in™lude spe™sIQ from ƒt—nd—rd wv would result in mu™h ™le—ner interf—™esD without ™—using gre—t inE wv h—s —n oper—tor a to test the equ—lity of two ™onvenien™eF v—lues @whi™h must h—ve the s—me typeAF †—lues of yne of the —rguments for in™lude is th—t it helps —ny of the primive types @integerD re—lD stringD et™FA in writing ™on™isely — sign—ture for modules th—t m—y ˜e tested for equ—lityD ˜ut v—lues of fun™tion s—tisfy sever—l dierent spe™i™—tionsF gonsider — type m—y notF e˜str—™t typesD of whi™h the proE sign—ture reƒr of h—sh—˜le v—luesD —nd — sign—ture gr—mmer h—s purposely hidden the represent—tionD q‚y € for m—them—ti™—l group stru™turesX —lso do not ’—dmit equ—lityY4 they —re not ’equ—lity sign—ture reƒr a typesF4 sig type v—lue eny v—lues of — re™ord type or d—t—type ˜uilt only v—l h—sh X v—lue Eb int from ’equ—lity types4 m—y ˜e ™omp—red for equ—lE end ityF iqu—lity of re™ordsD listsD —nd so on is stru™tur—lX the re™ord @xIY yIA is equ—l to @xPY yPA if xI a xP —nd sign—ture q‚y € a yI a yPY there is no w—y to tell if the two re™ords sig type elem —re —t the s—me —ddressF v—l id X elem „his is —ll very wellD ˜ut now there is — ™ompli™—E v—l B X elem B elem Eb elem tionF gonsider the progr—m v—l inverseX elem Eb elem fun —lleq@—D˜D™A a —a˜ —nd—lso ˜a™ end row ™—n these ˜e ™om˜ined to m—ke — sign—ture for v—l t a —lleq@QDQDQA h—sh—˜le groupsc ‡ith in™ludeD one ™ould write sign—ture reƒrq‚y € a v—l x a —lleq@fn xabxCID @B svviqev3 BA sig in™lude reƒr fn xabICxD in™lude q‚y € fn xabxCIA sh—ring type v—lue a elem „he fun™tion —lleq should h—ve — type resem˜ling end VX      3 ˜oolD so th—t we ™—n p—ss three fut su˜stru™tures serve —lmost —s ™on™iselyD withE integers to itD or three stringsD or three lists of re—l out using in™ludeX num˜ersF fut we ™—nnot p—ss —ny v—lues of — type sign—ture reƒrq‚y € a @su™h —s int 3 intA th—t does not —dmit equ—lityY sig stru™ture rX reƒr thus the l—st de™l—r—tion must ˜e illeg—lF @efter —llD stru™ture qX q‚y € to tell whether two fun™tions —re ’equ—l4 the ™omE sh—ring type rFv—lue a qFelem piler must ˜e —˜le to tell whether they give the s—me end results on —ll inputsD whi™h is r—ther di™ultFA sn f—™tD the l—tter —ppro—™h is more ro˜ustD sin™e sn ƒt—nd—rd wv the pro˜lem is resolved ˜y introE unfortun—te n—ming ™oin™iden™es ˜etween the two du™ing ’equ—lity type v—ri—˜lesD4 whi™h ™—n ˜e inE sign—tures ™—n ˜e distinguished ˜y qu—lied idenE st—nti—ted only ˜y types th—t —dmit equ—lityF „husD tiers @im—gine th—t the reƒr sign—ture —lso h—d the type of —lleq is something like —n identity fun™tion idX v—lueEbv—lueAF „he only dis—dv—nt—ge is th—t the ™lient of reƒrq‚y € must Va X a  a  a 3 ˜ool either open q —nd rD or use qu—lied identiers su™h —s qFid inste—d of idF where we ™—n su˜stitute int for aD ˜ut not int 3 intF sn —n @eƒgssA wv progr—mD equ—lity type v—riE —˜les —re written st—rting with two —postrophes inE R €ro˜lems in ™ompiling wv ste—d of just oneF „his seems like — ™lever solutionD ˜ut it introdu™es wv is designed to ˜e ™ompiledX m—ny things ™—n ˜e three kinds of pro˜lems into the wv l—ngu—geX ev—lu—ted —t ™ompile timeF wv h—s st—ti™ typesD

IQs —m not proposing to remove open de™l—r—tions from IF „he st—ti™ sem—nti™s of the l—ngu—ge ˜e™ome expressionsD just open spe™s from sign—turesF very ™ompli™—tedY

IV PF ™ode gener—tion —nd the runtime system reE ne™ess—ry for ordin—ry exe™utionF „he —rgument is quire unple—s—nt spe™i—l ™—sesY often m—de th—t these t—gs —re there to —llow the g—r˜—ge ™olle™tor to tr—verse pointers —nd re™ordsF QF —nd perh—ps progr—mming with equ—lity types fut it9s possi˜le to devise — g—r˜—ge ™olle™tor th—t isn9t — good ide— —nyhowF relies on the st—ti™ type inform—tion ™omputed —t ƒt—ti™ sem—nti™sX xow the l—ngu—ge designE ™ompile time ‘Q“D without —ny runtime t—gs on d—t—F ers must worry —˜out type ™onstru™tors th—t —dE purthermoreD even — ™onvention—l g—r˜—ge ™olle™tor mit equ—lityD spe™s in sign—tures of types th—t —dE might use — fsfy€ @fig f—g of €—gesA s™heme th—t mit equ—lityD prop—g—tion of the equ—lity property groups m—ny o˜je™ts of simil—r type on the s—me through sh—ring ™onstr—ints —nd fun™torsD —nd so p—geD so th—t one t—g su™es for —ll of themF „hen onF sn „he henition of ƒt—nd—rd wvD no fewer the runtime ’equ—lity interpreter4 f—™es — very ™omE th—n twentyEtwo p—ges mention some synt—™ti™ or plex t—sk in underst—nding the stru™ture of o˜je™tsF sem—nti™ —spe™t of equ—lity typesY this is —pproxiE es to the provision of impli™it —rguments to fun™E m—tely one out of every four p—ges of the heniE tionsD this is work—˜le ˜ut ineleg—ntF es the gomE tionF „he r—mi™—tions of equ—lity simil—rly met—sE ment—ry on ƒt—nd—rd wv st—tesD ’the st—ti™ —nd t—size throughout — ƒt—nd—rd wv ™ompilerF iqu—lE dyn—mi™ sem—nti™s ™—n ˜e studied independently of ity types —dd signi™—nt ™omplexity to the l—ngu—ge one —notherF4 ‘QHD pref—™e“ sn stru™turing — ™omE —nd its implement—tionF pilerD it is very ™onvenient th—t tr—nsl—tion of exE hyn—mi™ sem—nti™sX sn —lmost every respe™t pressions into m—™hine l—ngu—ge is independent of the type ™he™king of —n wv progr—m is distin™t from the types of the expressionsF ‚equiring th—t some the ev—lu—tion of the progr—mF „husD type ™he™king expressions must ˜e tre—ted spe™i—lly depending on ™—n ˜e done —t ™ompile timeD —nd type t—gs need their types ™orrupts the interf—™e ˜etween the ™omE not ˜e ™—rried on runtime o˜je™tsF „his s—ves ™onE ponents of the ™ompilerF sider—˜le sp—™e —nd timeD —nd is one of the most €rogr—mming with equ—lity typesX en oftE import—nt fe—tures of the l—ngu—geF used ex—mple of the utility of equ—lity types is the fut — fun™tion @su™h —s —lleqD —˜oveA must ˜e implement—tion of sets @with unionD interse™tionD —˜le to test v—ri—˜les for equ—lityD even though et™FA —s listsF „husD the type of these v—ri—˜les is polymorphi™ —nd not fun set@xA a xXXnil known until run timeF „here —re two w—ys th—t this fun mem˜er@xD nilA a f—lse might ˜e —™™omplishedX | mem˜er@xD —XXrA a xa— orelse IF „he runtime represent—tion of e—™h o˜je™t ™—n mem˜er@xDrA h—ve su™ient t—g inform—tion to determine fun union@—XXrD˜A a whether the o˜je™t is — pointerD —nd if soD how if mem˜er@—D˜A m—ny elds —re in the pointedEto re™ordD —nd then union@rD˜A whether the re™ord is — ref ™ellF „hen —n else —XXunion@rD˜A ’equ—lity interpreter4 ™—n re™ursively tr—verse | union@nilD˜A a ˜ d—t— stru™tures to test ˜itwise equ—lity on nonE „hen these fun™tions ™—n ˜e used to m—ke sets pointersD —nd stru™tur—l equ—lity on pointersF s whose elements —re —ny type D —s long —s  —dE ˜elieve this is the solution ™hosen in —ll existing mits equ—lity @iFeFD doesn9t ™ont—in ™omponents of wv ™ompilersF fun™tion—l or —˜str—™t typeAF end the progr—mmer doesn9t even h—ve to provide —n expli™it equ—lity PF „he represent—tion of —ny form—l p—r—meter fun™tion|the ™ompiler gures it —ll outF whose type is — polymorphi™ equ—lity type v—riE —˜le ™ould ˜e — p—irD whose rst eld is the fut there —re two very signi™—nt pro˜lems with v—lue itself —nd whose se™ond eld is — fun™E this progr—mD —nd these pro˜lems —re su™iently tion for testing equ—lity on v—lues of th—t typeF gener—l th—t they m—y —e™t —ny progr—m th—t „hen — fun™tion su™h —s —lleq ™ould use these m—kes mu™h use of equ—lity type v—ri—˜lesF pirstD impli™it p—r—meters to perform equ—lity testE the set union fun™tion t—kes qu—dr—ti™ timeF eny ingF „his is the solution —dopted in r—skell‘RR“D re—listi™ progr—m th—t de—ls with sets will w—nt to whi™h gener—lizes the notion of equ—lity types m—ke set union t—ke line—r timeY —nd this ™—n only to in™lude other kinds of overlo—dingF ˜e done if there is some sort of ordering @lessEth—nA ™omp—rison oper—tor —v—il—˜le on the elementsD or „here —re dis—dv—nt—ges to either solutionF „he some w—y to h—sh the elements to integer v—luesF rst requires runtime t—gs whi™h —re otherwise not „husD — ’produ™tion qu—lity4 set —˜str—™tion will ˜e

IW p—r—meterised ˜y more th—n just —n equ—lity fun™E v—lue must ˜e the s—me size|one word in — typi™—l tionF implement—tionAF ƒe™ondD ™onsider wh—t h—ppens with sets of setsF „his s™hemeD if —pplied to — d—t—type like listD es —n ex—mpleD would require th—t the represent—tion of —XX˜ ˜e — v—l — a union@set@IADset@PAA pointer to — twoEelement re™ord ™ont—ining — ™onE v—l ˜ a union@set@PADset@IAA stru™tor —nd — v—lueY the v—lue would ˜e — pointer v—l x a set@—A to —nother p—ir ™ont—ining — —nd ˜F i—™h element of v—l t a mem˜er@˜DxA the listD thenD requires not one ’™ons ™ell4 ˜ut two3 „he set x h—s — single element th—t is the set fIY PgY g—rdelli9s wv ™ompiler‘U“ —voided this extr—v—E the l—st line tests the set fPY Ig for mem˜ershipF g—n™e ˜y t—king —dv—nt—ge of the f—™t th—t in the yf ™ourseD the progr—m will tell us th—t ˜ TP f—gD runtime represent—tion of v—luesD pointers ™ould ˜e whi™h viol—tes the set —˜str—™tionF „he pro˜lem distinguished from sm—ll integersF „husD the ™omE is th—t stru™tur—l equ—lity is the wrong equ—lity to piled ™ode ™ould tell whi™h ™onstru™tor @nil or XXA use on setsY the progr—mmer should re—lly provide h—d ˜een —pplied ˜y seeing if the v—lue w—s — sm—ll —n eq•set fun™tion th—t tests whether two sets h—ve integer @nilA or — pointer @XXAF „he pointer would the s—me elementsF then point dire™tly —t — re™ord ™ont—ining — —nd ˜F „husD impli™it stru™tur—l equ—lity is often ˜—d „hus the represent—tion of lists in g—rdelli9s ™omE progr—mming pr—™ti™eF „he progr—mmer should piler @—nd in every su˜sequent wv ™ompilerA is just provide —n expli™it equ—lity fun™tion ˜e™—use @IA the like the represent—tion used in vispF expli™it fun™tion will likely ˜e more e™ient to useD sn f—™tD —ll these ™ompilers gener—lize the ide— —nd @PA the expli™it fun™tion will h—ve the right seE slightlyX in —ny d—t—type with just one nonE™onst—nt m—nti™s for the —ppli™—tionF ™onstru™tor @—nd —ny num˜er of ™onst—nt ™onstru™E e re—son—˜le ™ompromise would ˜e to —llow — torsAD if the nonE™onst—nt ™onstru™tor ™—rries — v—lue kind of st—ti™—lly overlo—ded equ—lity fun™tionD of th—t is —lw—ys represented ˜y — pointerD then —n exE the kind found in e—rlier versions of ƒt—nd—rd wv tr— indire™tion to ™—rry the ™onstru™tor is not ne™E ‘PW“F „his equ—lity oper—tor worked on —ny nonE ess—ryF fun™tion—l monomorphi™ typeF ƒu™h —n oper—tor is xowD ™onsider the following perfe™tly leg—l ƒt—nE quite ™onvenient to the progr—mmerD —nd does not d—rd wv progr—mX unduly ™ompli™—te the l—ngu—ge sem—nti™sD ™omE fun™tor p@type 9— t pilerD or runtime systemF @r—lf —s m—ny p—ges of IR d—t—type 9— list a the henition would mention equ—lityY equ—lity nil | XX of 9— t —ttri˜utes would ™e—se to inter—™t with the type A a stru™t F F F endY ™he™ker or the module systemY no ’equ—lity interE preter4 would ˜e needed in the runtime systemFA st stru™ture ƒ a must ˜e —dmitted th—t with this solution @—s with p@d—t—type 9— list a wv overlo—dingA we —re left without prin™ip—l types nil | XX of 9— B 9— list in some ™—sesF type 9— t a 9— B 9— list AY h—t—type represent—tions sn ™ompiling the fun™tor p D the ™ompiler does not ‚e™ursive d—t— types —re de™l—red in wv using know whether the represent—tion of 9— t is —lw—ys d—t—typeD whi™h denes the ™onstru™tors @—nd —sE — pointerY so —n expli™it indire™tion @— re™ord for the so™i—ted typesA of — disjoint union typeF vinked lists ™onstru™torA must ˜e used in the represent—tion of —re just — spe™i—l ™—se of this more gener—l notionF listF „he runtime represent—tion of — typi™—l d—t—type fut in ™ompiling the stru™ture ƒD the —™tu—l p—E element ™onsists of — ™onstru™tor —nd —n —sso™i—ted r—meter h—s — d—t—type list in whi™h the v—lue ™—rE v—lueF e str—ightforw—rd implement—tion of this ried ˜y XX is — re™ordD —nd thus —lw—ys — pointerF represent—tion would ˜e —s — twoEelement re™ordD ƒo the represent—tion ™hosen ˜y the ™ompiler will with one eld ™ont—ining — sm—ll integer t—g @st—ndE use g—rdelli9s optimiz—tionF ing for the ™onstru™torA —nd the other ™ont—ining „hen when lists ™re—ted outside of p —re p—ssed the v—lue @sin™e wv h—s polymorphi™ typesD every to fun™tions inside p D the progr—m will go wrongX dierent ™ompil—tion units will dis—gree —˜out the IR€—ges RD IVD IWD PID PPD PSD PTD URD USD UUD UW of the henition‘QI“ would still mention equ—lityY p—ges IQD ITD QQD represent—tion of listsF QSD QTD QWD RHD RID RQD RRD SU would no longer need toF „husD ƒt—nd—rd wv does not permit g—rdelli9s

PH optimiz—tionYIS ˜ut —ll the implement—tions use it „he initi—l ˜—sis ˜e™—use the —ltern—tive is too expensiveF „he henition spe™ies —n initi—l ˜—sisD th—t isD — set „he pro˜lem is — ˜it more gener—lF „here —re of predened typesD v—luesD —nd ex™eptions th—t —re m—ny other possi˜le gener—liz—tions of g—rdelli9s the ’˜uiltEin fun™tions4 @et™FA of —ny wv systemF te™hniqueD —ll with the —im of m—king the repE „hese in™lude the —rithmeti™ oper—tors on integers resent—tions of d—t—types more ™omp—™t —nd eE —nd re—lsD string ™on™—ten—tionD — few oper—tors on ™ientF xone of these te™hniques work —™ross fun™tor listsD —nd so onF ˜ound—riesF „he initi—l ˜—sis is not l—rge enough to write re—l g—rdelli9s te™hnique is — v—ri—nt of the ide—D progr—ms th—t use nontrivi—l inputGoutputD or th—t p—y for —˜str—™tion only where things —re —˜str—™tF inter—™t mu™h with the oper—ting systemF „h—t9s veroy9s represent—tion —n—lysis —pplies to fun™tionsY perfe™tly —™™ept—˜leY this is — l—ngu—ge denitionD g—rdelli9s to d—t— stru™turesF fut it —ppe—rs th—t not — li˜r—ry moduleF „he type —nd module systems this ide— ™—nnot ˜e m—de to —pply to re™ursive of ƒt—nd—rd wv —re —dequ—te to des™ri˜e —ppropriE d—t—types in ƒt—nd—rd wvY this is extremely unE —te li˜r—riesD —nd th—t9s wh—t is import—ntF fortun—teF s ˜elieve the pro˜lem lies in the p—rti—l fut the initi—l ˜—sisD su™h —s it isD h—s some rough —˜str—™tion of d—t—typesF sn the ex—mple —˜oveD edgesX the progr—mmer h—s —˜str—™ted    list into  tD ˜ut h—s not —˜str—™ted the d—t—type listF „his is  „here —re fun™tions for re—ding —nd writing —n unusu—l progr—mF „he whole point of — ™onE strings of ™h—r—™tersD for ™onverting integers ™rete d—t—type is th—t it is not —˜str—™tY if the proE into singleE™h—r—™ter strings @—nd ˜—™kAD —nd gr—mmer w—nted —n —˜str—™t type in the interf—™e for ™on™—ten—ting stringsD —nd for ’exploding4 then the p—r—meter of p wouldn9t h—ve mentioned strings into lists of singleE™h—r—™ter stringsD —nd — d—t—type —t —llF ’imploding4 @™on™—ten—ting — list of strings toE „husD — solution to this pro˜lem might ˜e to getherAF fut there is no w—y to —™™ess the ith ™h—nge very slightly the notion of — d—t—typeF snE ™h—r—™ter of — string in ™onst—nt time|there is ste—d of s—ying th—t — d—t—type is the disjoint sum no su˜string oper—tor3 „he only w—y to extr—™t of sever—l typesD let us s—y th—t it is the disjoint —n intern—l ™h—r—™ter of — string is to explode sum of sever—l produ™t typesF „h—t isD the v—lue the string —nd then to tr—verse the resulting ™—rried ˜y — ™onstru™tor is not just — typeD it is — listY this t—kes time line—r in the length of the re™ord typeF xote th—t this is ex—™tly the w—y th—t stringF — v—ri—nt re™ord works in €—s™—lF  „here is no w—y to m—ke upd—te—˜le —rr—ys „hen the pro˜lem—ti™ progr—m —˜ove would not with ™onst—ntEtime —™™ess to —r˜itr—ry eleE ˜e leg—lF „he fun™tor denition would ˜e —llowedD mentsF err—ys ™—n ˜e simul—ted ˜y lists @or ˜ut the d—t—type in the —™tu—l p—r—meter would not treesA of ref ™ellsD ˜ut —™™ess —nd upd—te opE m—t™h the d—t—type in the form—l p—r—meterF er—tions will then t—ke line—r @or log—rithmi™A „his slight restri™tion would —llow ™ompilers to timeF pd—te—˜le —rr—ys —re ™ert—inly not out use mu™h more e™ient represent—tions of ™on™rete of pl—™e in — l—ngu—ge with upd—te—˜le refsF d—t—types in wvF et present we —re experimentE ing with —n implement—tion of this represent—tion  „he —rithmeti™ oper—tors m—y overowD in @—nd ™onsequent l—ngu—ge restri™tionA to explore whi™h ™—se the henition pres™ri˜es th—t C will this tr—deoF r—ise the ƒum ex™eptionD B will r—ise the €rod exE yne might think th—t — ™ompiler should —lso repE ™eptionD —nd so onF st is extremely in™onvenient resent e—™h element of —n @int  intAlist —s — triple for the implementor to h—ve distin™t ex™epE @intY intY t—il pointerAF fut here the produ™t type tions for the dierent oper—torsY most ™omputE @int intA is not p—rt of the d—t—type itselfD ˜ut p—rt ers don9t r—ise sep—r—te h—rdw—re ex™eptions for of the type p—r—meter of the list ™onstru™torF „his dierent kinds of overowF end the progr—mE would le—d to pro˜lems when polymorphi™ fun™tions mer would —lmost —lw—ys ˜e served just —s well on list types —re —pplied to — spe™i—llyErepresented ˜y — single ex™eption ™—lled yverflowF listsF „husD su™h —n optimiz—tion h—s pro˜lems not only —t fun™tor ˜ound—ries ˜ut —t fun™tion ˜oundE  „here is no ˜it string typeD —nd there —re no —riesF ˜itwise logi™—l oper—tors on the integer typeF „here —re m—ny —ppli™—tions of ˜itwise operE ISg—rdelliD of ™ourseD w—s not ™ompiling — l—ngu—ge with —tors in gr—phi™sD num˜er theoryD ™ryptogr—E fun™torsF phyD —nd other —re—sF yn the other h—ndD it

PI is worth noting th—t wv9s div —nd mod h—ve hefenseD x—v—l €u˜li™—tions —nd porms genterD rounding ˜eh—vior @tow—rds neg—tive innityD €hil—delphi—D €eD IWVHF not tow—rds zeroA th—t —llow shifts —nd m—sks ‘P“ „hom—s iF endersonD fri—n xF fersh—dD idE to ˜e dened using powers of twoY ™ompilers w—rd hF v—zowsk—D —nd renry wF vevyF ƒ™heduler ™ould optimize this ™—seD in prin™ipleF —™tiv—tionsX ie™tive kernel support for the userE level m—n—gement of p—r—llelismF egw „r—nsF on  pon —n inputGoutput errorD the so ex™eption gomputer ƒystemsD IH@IAXSQ{UWD pe˜ru—ry IWWPF is r—ised with — string —rgumentF „he form—t ‘Q“ endrew ‡F eppelF ‚untime t—gs —ren9t ne™ess—ryF of the —rgument is spe™ied in the henitionD visp —nd ƒym˜oli™ gomput—tionD PXISQ{TPD IWVWF —nd this form—t does not provide enough inE ‘R“ endrew ‡F eppelF gompiling with gontinu—tionsF form—tion for serious —ppli™—tionsF st would g—m˜ridge niversity €ressD IWWPF h—ve ˜een prefer—˜le to le—ve the ™ontents of the string unspe™ied r—ther th—n prem—turely ‘S“ endrew ‡F eppel —nd h—vid fF w—™ueenF e ƒt—nd—rd wv ™ompilerF sn qilles u—hnD editorD settling on —n in—dequ—te st—nd—rdF pun™tion—l €rogr—mming v—ngu—ges —nd gomputer  „o nish on — trivi—l noteX the list ™on™—ten—E er™hite™ture @vxgƒ PURAD p—ges QHI{PRD xew ‰orkD IWVUF ƒpringerE†erl—gF tion oper—tor d is de™l—red inxD —sso™i—ting to the leftF €rogr—ms would ™ompute the s—me ‘T“ endrew ‡F eppel —nd h—vid fF w—™ueenF ƒt—nE result under right —sso™i—tivityD ˜ut would run d—rd wv of xew terseyF sn w—rtin ‡irsingD ediE f—sterD sin™e d must ™opy its left —rgument ˜ut torD „hird snt9l ƒympF on €rogF v—ngF smplemenE t—tion —nd vogi™ €rogr—mmingD p—ges I{IQD xew not its right oneF ‰orkD eugust IWWIF ƒpringerE†erl—gF st is worth noting th—t every implement—tion of ‘U“ vu™— g—rdelliF gompiling — fun™tion—l l—ngu—geF sn wv sin™e g—rdelli9s h—s h—d — ™onst—nt time —rr—y IWVR ƒympF on vsƒ€ —nd pun™tion—l €rogr—mmingD su˜s™ript —nd —n e™ient su˜string fun™tionY the p—ges PHV{IUD xew ‰orkD IWVRF egw €ressF henition ™ould h—ve provided — helpful st—nd—rdE ‘V“ ‡ill glinger —nd v—rs „hom—s r—nsenF ss expli™it iz—tionF de—llo™—tion re—lly f—ster th—n g—r˜—ge ™olle™tionc unpu˜lished m—nus™riptD IWWPF ‘W“ iri™ gF gooper —nd tF qregory worrisettF edding S gon™lusion thre—ds to ƒt—nd—rd wvF „e™hni™—l ‚eport gw E gƒEWHEIVTD ƒ™hool of gomputer ƒ™ien™eD g—rnegie „he popul—rity of wv seems to ˜e in™re—singD ˜oth wellon niversityD €itts˜urghD €eD he™em˜er IWWHF —s — l—ngu—ge for writing re—l progr—ms —nd —s — ‘IH“ vuis h—m—sF „ype essignment in €rogr—mming st—rting point for theoreti™—l investig—tions of type v—ngu—gesF €hh thesisD hep—rtment of gomputer theory —nd l—ngu—ge designF €rogr—mmers should ƒ™ien™eD niversity of idin˜urghD IWVSF note th—t the good points of wv dis™ussed in this ‘II“ fru™e hu˜—D ‚o˜ert r—rperD —nd h—vid w—™E p—per —re —ll r—ther gener—l —nd import—ntY the ™ritE ueenF „yping rstE™l—ss ™ontinu—tions in wvF i™isms tend to ˜e n—rrowD te™hni™—lD —nd not —lw—ys sn iighteenth ennu—l egw ƒympF on €rin™iples import—ntF of €rogF v—ngu—gesD p—ges ITQ{UQD xew ‰orkD t—n „heorists should note th—tD even though some of IWWIF egw €ressF the ™riti™isms —re minor —nd not of mu™h theoreti™—l ‘IP“ wF tF qordonD eF tF wilnerD —nd gF €F ‡—dsworthF interestD they —ll —e™t the us—˜ility of the l—ngu—geF idin˜urgh vgpF ƒpringerE†erl—gD xew ‰orkD IWUWF „hose theorists who —nti™ip—te designing — l—ngu—ge ‘IQ“ gF eF ‚F ro—reF rints on €rogr—mmingEv—ngu—ge themselves somed—y might w—nt to remem˜er this hesignD p—ges IWQ{PITF €renti™e r—llD IWVWF ™ritiqueD —long with the ™l—ssi™s of the genre‘IQD RT“F keynote —ddress to the egw ƒsq€vex ™onferen™e in IWUQF e™knowledgment ‘IR“ ‚eport on the progr—mming l—ngu—ge r—skellX †erE sion IFIF „e™hni™—l ‚eport „e™hni™—l ‚eportD ‰—le s would like to th—nk houg w™slroy —nd —n —nonyE niversity —nd ql—sgow niversityD eugust IWWIF mous referee for m—ny v—lu—˜le ™ommentsF ‘IS“ ‚eport on the progr—mming l—ngu—ge r—skellD — nonEstri™tD purely fun™tion—l l—ngu—geD version IFPF ‚eferen™es ƒsq€vex xoti™esD PU@SAD w—y IWWPF ‘IT“ u—thleen tensen —nd xikl—us ‡irthF €—s™—lX ser ‘I“ wilit—ry st—nd—rdX ed— progr—mming l—ngu—geF w—nu—l —nd ‚eportF ƒpringerE†erl—gD xew ‰orkD „e™hni™—l ‚eport wsvEƒ„hEIVISD hep—rtment of IWURF

PP ‘IU“ €ierre touvelot —nd h—vid uF qiordF elge˜r—i™ ‘QP“ qreg xelsonD editorF ƒystems €rogr—mming with re™onstru™tion of types —nd ee™tsF sn iighteenth wodul—EQF €renti™e r—llD inglewood glisD xtD ennu—l egw ƒympF on €rin™iples of €rogF v—nE IWWIF gu—gesD p—ges QHQ{QIHD xew ‰orkD t—n IWWIF egw ‘QQ“ ƒ™ott xettles —nd t—mes ‡F y9„ooleF g—rnegie €ressF wellon nivFD €itts˜urghD €eD person—l ™ommuniE ‘IV“ ƒtef—n u—esF „ype inferen™e in the presen™e of ™—tion from ƒ™ott xettlesD IWWHF overlo—dingD su˜typing —nd re™ursive typesF sn ‘QR“ tF ‚ees —nd ‡F glingerF ‚evised report on the €ro™F IWWP egw gonfF on visp —nd pun™tion—l —lgorithmi™ l—ngu—ge ƒ™hemeF ƒsq€vex xoti™esD €rogr—mmingD p—ges IWQ{PHRF egw €ressD IWWPF PI@IPAXQU{UWD IWVTF ‘IW“ fri—n ‡F uernigh—n —nd hennis wF ‚it™hieF „he g ‘QS“ tohn rF ‚eppyF gon™urrent progr—mming with €rogr—mming v—ngu—geF €renti™eEr—llD inglewood eventsF „e™hni™—l reportD gornell niversityD heptF glisD xtD IWUVF of gomputer ƒ™ien™eD sth—™—D x‰D IWWHF ‘PH“ endrew uoenigF g „r—ps —nd €itf—llsF eddisonE ‘QT“ tohn rF ‚eppy —nd imden ‚F q—nsnerF „he eˆene ‡esleyD ‚e—dingD w—ssD IWVWF li˜r—ry m—nu—lF gornell nivF heptF of gomputer ƒ™ien™eD w—r™h IWWIF ‘PI“ ˆ—vier veroyF n˜oxed o˜je™ts —nd polymorphi™ typingF sn xineteenth ennu—l egw ƒympF on ‘QU“ golin ‚un™im—n —nd h—vid ‡—kelingF re—p prolE €rin™iples of €rogF v—ngu—gesD p—ges IUU{IVVD xew ing of l—zy fun™tion—l progr—msF „e™hni™—l ‚eport ‰orkD t—nu—ry IWWPF egw €ressF IUPD niversity of ‰orkD heptF of gomputer ƒ™iE en™eD reslingtonD ‰ork ‰HI ShhD nited uingdomD ‘PP“ ˆ—vier veroy —nd wi™hel w—unyF hyn—mi™s in epril IWWPF mlF sn tF rughesD editorD pun™tion—l €rogr—mming ‘QV“ hong ƒh—o —nd endrew ‡F eppelF ƒm—rtest v—ngu—ges —nd gomputer er™hite™tureX Sth egw re™ompil—tionF sn €ro™F „wentieth ennu—l egw gonferen™e @vxgƒ SPQAD p—ges RHT{RPTF ƒpringerE ƒsq€vexEƒsqeg„ ƒympF on €rin™iples of €roE †erl—gD IWWIF gr—mming v—ngu—gesD p—ge to —ppe—rF egw €ressD ‘PQ“ ˆ—vier veroy —nd €ierre ‡eisF €olymorphi™ type IWWQF inferen™e —nd —ssignmentF sn iighteenth ennu—l ‘QW“ ‚o˜ert eF ƒh—wF smproving g—r˜—ge ™olle™tor perE egw ƒympF on €rin™iples of €rogF v—ngu—gesD form—n™e in virtu—l memoryF „e™hni™—l ‚eport p—ges PWI{QHPD xew ‰orkD t—n IWWIF egw €ressF gƒvE„‚EVUEQPQD ƒt—nford niversityD €—lo eltoD ‘PR“ renry vie˜erm—n —nd g—rl rewittF e re—lEtime geD IWVUF g—r˜—ge ™olle™tor ˜—sed on the lifetimes of o˜je™tsF ‘RH“ te—nE€ierre „—lpin —nd €ierre touvelotF €olymorE gommuni™—tions of the egwD PT@TAXRIW{PWD IWVQF phi™ typeD regionD —nd ee™t inferen™eF „e™hni™—l ‘PS“ tohn wF vu™—ssen —nd h—vid uF qiordF €olyE ‚eport iw€Eg‚s iGISHD i™ole des wines de €—risD morphi™ ee™t systemsF sn pifteenth ennu—l egw pe˜ru—ry IWWIF ƒympF on €rin™iples of €rogF v—ngu—gesD p—ges RU{ ‘RI“ w—ds „ofteF „ype inferen™e for polymorphi™ refE SUD xew ‰orkD t—n IWVVF egw €ressF eren™esF snform—tion —nd gomput—tionD VWXI{QRD xovem˜er IWWHF ‘PT“ h—vid w—™ueenF wodules for ƒt—nd—rd wvF sn €ro™F IWVR egw gonfF on vsƒ€ —nd pun™tion—l ‘RP“ h—vid wF ng—rF „he hesign —nd iv—lu—tion of — €rogr—mmingD p—ges IWV{PHUD xew ‰orkD IWVRF righ €erform—n™e ƒm—llt—lk ƒystemF ws„ €ressD egw €ressF g—m˜ridgeD weD IWVTF ‘PU“ h—vid fF w—™ueenF we—kEtypesF histri˜uted ‘RQ“ €hilip ‡—dlerF „he essen™e of fun™tion—l progr—mE with ƒt—nd—rd wv of xew terseyD IWVVF ming @invited t—lkAF sn xineteenth ennu—l egw ƒympF on €rin™iples of €rogF v—ngu—gesD p—ges I{ ‘PV“ ‚o˜in wilnerF e theory of type polymorphism in IRD xew ‰orkD t—n IWWPF egw €ressF progr—mmingF tourn—l of gomputer —nd ƒystem ‘RR“ €hilip ‡—dler —nd ƒtephen flottF row to m—ke ƒ™ien™esD IUXQRV{USD IWUVF —dEho™ polymorphism less —d ho™F sn ƒixteenth enE ‘PW“ ‚o˜in wilnerF e propos—l for ƒt—nd—rd wvF sn nu—l egw ƒympF on €rin™iples of €rogF v—ngu—gesD egw ƒymposium on vsƒ€ —nd pun™tion—l €roE p—ges TH{UTD xew ‰orkD t—nu—ry IWVWF egw €ressF gr—mmingD p—ges IVR{WUD xew ‰orkD IWVRF egw ‘RS“ wit™hell ‡—ndF gontinu—tionE˜—sed multipro™essE €ressF ingF sn gonfF ‚e™ord of the IWVH visp gonfFD p—ges ‘QH“ ‚o˜in wilner —nd w—ds „ofteF gomment—ry IW{PVD xew ‰orkD eugust IWVHF egw €ressF on ƒt—nd—rd wvF ws„ €ressD g—m˜ridgeD w—sE ‘RT“ tF ‡elshD ‡F tF ƒneeringerD —nd gF eF ‚F ro—reF s—™husettsD IWWIF em˜iguities —nd inse™urities in €—s™—lF ƒoftw—re| ‘QI“ ‚o˜in wilnerD w—ds „ofteD —nd ‚o˜ert r—rperF €r—™ti™e —nd ixperien™eD U@TAXTVS{WTD IWUUF „he henition of ƒt—nd—rd wvF ws„ €ressD g—mE ‘RU“ xikl—us ‡irthF €rogr—mming in wodul—EPF ˜ridgeD weD IWVWF ƒpringerE†erl—gD xew ‰orkD x‰D IWVIF

PQ ‘RV“ endrew uF ‡rightF €olymorphi™ referen™es for mere mort—lsF sn €ro™eedings of the iurope—n ƒymE posium on €rogr—mmingD IWWPF

PR