;     TeX output 1995.07.01:1517                                       g\32\ܚ\NpK ff ff cmbx14BeyondLProtwotyp8eImplementa>tions:͍f>PolymorphiccLPro !jectionAnalys8is E.forLGlasgowHaskell"% 3"V 
   
   cmbx10JulianTSew9ard   <x 
   
   cmtt10sewardj@cs.man.ac.uki xz%o 	   	   cmr9Depart9mentTofCompute	rScience   %Victor'xiaTUniv9e	rs ityofMancheAste	r ZOxfordTRoad,Manc9heAste	rTM139PL,UK.mkHs&t: 	   	   cmbx9AhbKstract.xBuildingdeect9iveabNstractinte	rpretersdrequireAscarefulat-Hstent9ionRtobAotThth9eoryandenginee	r'xingRi sNsueAs.ThetTheoryofabNstractHsinte	rpret9ationi sw9elld؇evelop eAd,buttTheenginee	r'xings id؇ehasf allenbe-Hshin9dqsomewhat,anunfortunateqeventgiventThatabNstractinte	rpretationi sHspAotent9iallyakeytechnologyford؇eclarativelanguagecompilation.Thi sHspap e	rsho9wstThetThinkingb e>hindtThed؇eAs ignandimplementationofaHsrst-ord؇e	r,pAolymorphicpro ject9ionanalys.erforHask9ell,capableofd؇e-Hstect9ingheNadstr'xictneAsNs,andtThe	reforesuitableforsuppAortingallknownHsstr'xictn9eAsNs-relatedtransformat9ions.DevelopmentculminateAdinasucceAsNs-HsfulPtr'xialinst9allationPinv9e	rs ion0.19oftTh9eGlasgowHaskellCompile	r,Hsan9dtThesystemhasb eenus.eAdtoanalysearangeofHask9ellprograms,HsincludingTaneNarlie	rv9ers ionofitfs.elf,13000lin9eAslong."Ѝ,  (N       cmbx121
 Inftro` d uctionx,  K`y 
   
   cmr10The#pastdTecade#hass1eenadramÎa ticimprovementintUhep#e
rformÎanceoflazy,  furnctionÎallanguageGs,notablyHaskell,asimplementrorshavedTevelop#eGdwaystro,  mÎapsuchlanrguageGsecientUlyontrostoGckarchitUectureGs.Neve
rtUheleGsqs,tUheystill,  rurnanordTe
rofmÎagnitudeslowe
rtUhantUheGirimp#e
ra tivecourntUe
rpart s,and,wors1e,,  itQloGoksliketUhep#e
rformÎanceimprovement saretailinrgo.F*urtUhe
rincreqas1eGsin,  p#e
rformÎanceVdTependonndinrgwaystroreplacecopyinrgbyupGdra tUe-in-place,and,  lazyevqalua tionbystr*ictevqalua tion,whenpGoqss#ible.Acr*iticalelementintUhi#sis,  tUheUUs1emÎanticanÎalys1eGswhichdi#sTcove
rwhensuchtransformÎa tionsarevqalid. ; SucceGsqsfulPNus1eofstr*ictneGsqsandshar*inrganÎalys1eGsincompile
rsdTemandscare-,  fulcons#idTe
ra tionoftUheenrginee
r*ingconstraint simpGoqs1edbys1epara tUecompilation,,  andVbytUhelimitUeGdcompurtingVreGsourcesavqailable.Section  2oftUhi#spape
rexam-,  ineGsYsuchconstraint sindTetail,asawayofgene
ra tinrgus1efulmetr*icswitUhwhich,  troasqs1eGsspGoss#ibilitiesintUhedTes#ignspace.Bas1edontUhi#s,weourtlineinSec-,  tion  3HtUhedTeGs#ignofapolymorphic,backwardsstr*ictneGsqsanÎalys1e
rforHaskell.,  TheanÎalys1e
rwasinstalleGdinGlasgowHaskell0.19,andshÎowsanurnpreceGdTen-,  tUeGd1pr*ice-p#e
rformÎancera tio.Section  4preGs1ent stUhereGsulrt softUhi#sexpe
r*imentand,  concludTeGs.RAlrtUhÎoughourpr*imaryconce
r#nisstr*ictneGsqsanÎalysisofHaskell,tUheGs1e,  idTeqasH=havewidTe
rapplicabilitytroallabqstract-intUe
rpreta tionbas1eGdanÎalyseGsfor                                          *g\32\ܚR  furnctionÎalolanguageGs,andshÎouldintUe
resttUhÎoqs1econce
r#nedbytUhes1eeminrglylarge  R  gapUUb#etweentUhetUheoryandpracticeofabqstractintUe
rpreta tion.wa Reqal,)usableanÎalys1eGsdie
rf*romprotrotyp#eimplementa tionsins1eve
ralways.R  TheN/anÎalys#ishastroruninreqasonÎabletimeandmemory*,evenwhenpreGs1entUedwitUhR  urnreqasonÎable2oinput s;itshÎould\t"prop#e
rlyintotUheexi#stinrgcompile
rf*rame-R  wor k,xvi#s-a-viss1epara tUecompilation,anditshÎoulddoagoGodjobforimportantR  lanrguagep-feqa tureGs,particularlysurm-of-proGduct styp#eGs,polymorphi#smandhighe
r-R  ordTe
rEfurnctions.W*eshÎortUlyexaminetUhecons1equenceGsoftUheGs1econstraint sinsomeR  dTetail.a TheemÎainfoGcusoftUhi#spape
risonglobaldTeGsigntradTeos.Bas1eGdontUha tR  di#sTcusqsion,gweourtUlineaparticularlyeectivepGolymorphicpro 8jectionanÎalys1e
rR  forHaskell,andshÎowsomereGsulrt sf*romit.TheanÎalys1e
r'sdTeGs#igndetailsareR  bGotUhintUe
restinrgandvolurminous,butnotappropr*ia tUehe
re,soreferenceGstromoreR  tUhÎoroughA
treqa tment saregiventUhroughÎourt{therstpGortofcalli#sprobablytUheR  aurtUhÎor'sUUPhDtheGs#is  [Sew948]. U鍑R  Arc9hit"ectural>OveDrview-ȲThi#s9pape
rdividTeGss1emÎanticanalys#issystUemsintroR  twoHconceptualpart s:anabqstractintUe
rpreter,Hwhichgene
ra tUeGsrecurs#iveequa tionsR  ove
r`somedomÎains,andaxpGointUe
r,whichremoveGsrecurs#ionf*romtUheequa tions,R  tUhe
reTby5mÎakinrgthemus1efultrocompile
rs.Asusual,werequiretUhedomÎainstrob#eR  of6nitUeheGight6troguaranteete
rminÎa tionofxpGointinrg,andfurtUhe
rreGstr*icttUhemR  troUUb#edistr*iburtiveUUla tticeGstromÎakexpGointinrgeqas#ie
r.a Seve
ral$dierentsTchemeGsforxpointinrghaveb#eenpropGoqs1ed.TheF*rontie
rsR  algor*itUhmb'cleve
rlyexploit smonotronicitytrobuildsyntacticallyurniquerepreGs1enta-R  tions, tUhustr*iviali#sinrgtUhedTetUectionofxpGoint s.IntroGduced byClackandPeytronR  JoneGs  [PC87 ],tUhealgor*itUhmhasb#eenmUuchturneGdove
rtUheyeqars  [Mar92Z,Hurn91o],R  andsuppGort shighe
rordTerxpGointinrg.As1econdlineofenquiryi#stUha toflazyR  xpGointinrg,6whe
retUhexpGointi#sonlycompurtUedwhe
reneeGdTed,ondTemÎand.TheR  preci#s1e1or*iginsoflazyxpGointinrgaredTeba table,1burttwoeqarlypreGs1enta tionsR  areduetrotUheCousot s  [CC78q]andtroJoneGsandMycroft  [JM86N=].ExtUens#ionsR  trohighe
r-ordTerxpGointinrgareshÎownbyF*e
rgusonandHugheGs  [FH93!],andbyR  Roqs1endrahl  [Ros93j].ΆThewor kofHankinandLeMGetaye
ron\lazytyp#eGs"  [HM94]R  i#sUUalsorela tUeGd.a In8tUhi#spape
rwetakeatUhirdapproach:compurta tionofcompletUexpGoint sR  by4us#inrgatUe
rmrewr*itesystemtrotransforms1emÎanticallyequivqalenttUe
rmstroR  syntactically8|idTentical8|normÎalforms.Cons1eldTeGsTcr*ib#es8|asimplerewr*itUe
rfortwo-R  pGointula tticesus1edinY*aleHaskell  [Con91!],andtUhetUechniquewasextUendTeGdtroR  otUhe
rla tticeGsin  [Sew948],Section5.Rewr*itUe-bas1eGdxpointUe
rscannot,ingeneral,R  solveUUhighe
r-ordTerequa tions,burt,asweshalls1ee,tUhi#smÎaynotma ttUe
rmUuch.a NoGcke
r  [Noc938]ѶshÎowsawor kinrganÎalys1e
r,baseGdon\abqstractreduction",R  whe
re8tUerm-rewr*itinrg8i#sus1eGdtoexecutUetUheprogramus#ingsomeabqstracts1e-R  mÎantics.dBycompar*i#son,ourtUe
rm-rewritinrgi#sus1eGdtodTetUectxpGoint s,andR  tUhe
re-vi#sacleqardistinction-vbetween-vtUheabqstractintUe
rpreta tionandxpGointinrgR  activitieGs.a Thepreci#s1enÎa tureofabqstractintUe
rpreta tionsi#sdTetUe
rmineGd,nÎa turally*,by                                         :g\32\ܚ,  tUhetransformÎa tiontrob#esuppGortUed.OneparticularlyimpGortantcharactUe
r*i#sa-  ,  tionZi#stUhela tticeGstrowhichdie
renttyp#eGsaremÎapp#eGd.IntUhes#impleGstcas1e,,  allRnon-furnctionÎaltyp#eGscouldbemÎappeGdtroatwo-pointRla ttice,witUhthepGoint s,  repreGs1entinrgRpnodTemÎandandweqakheqadnormÎalform(WHNF)RodTemandreGsp#ect-,  ivelyinstr*ictneGsqsanÎalys#is.F*oras#impleshar*inrganÎalys#is,wemightus1ea3-,  pGoint!chain,dTenotinrgnorefe
renceGs,exactUlyonerefe
rence,andtwoormore,  refe
renceGs.SimpleabqstractionsliketUheGs1earerourtinelyus1eGdinexi#stinrgHaskell,  compile
rs  [Con91!,PJ93].Thes#implicityoftUheabqstractionsmÎakeGstUheGs1eanÎalyseGs,  cheqapUUandreliable,soweshallnotcons#idTe
rtUhemfurtUhe
r.+; AmorepGowe
rfulanÎalys#ismighta ttUempttrogivedTetaileGdinformÎa tionabGourt,  furnctions?dTeqalingwitUhstructureGdtyp#eGssuchasli#st s,treeGs,orwha tUeve
rprogram-,  me
rs7^caretrodTene.La tticeGsabqstractinrgsuchtyp#eGsgrowinaccordrancewitUhthe,  complexityapoftUhÎoqs1etyp#eGs,sotUhe
rei#snoarbitrarycurtoappGointbeyondapwhich,  allLDdTetailsareignoreGd.InotUhe
rwords,tUhe
rei#sapGoqssibilityLDofs1eeGinrgarbitrar*ily,  f#ar\insidTe"dra tastructureGs.Thedowns#idTeistUha ttheGs1ela tticeGscananddoget,  ve
ry&large,sotUheanÎalys#is&becomeGs&expensive.&IntUhi#ss1ense,&semÎantic&analys#isis,  aQparticularlyintractableproblem,b#ecaus1etUhela ttices#izeGsandtUhusQamourntof,  eort*KrequireGdcangrowexponentially*KwitUhcomplexityoftyp#eGs.F*orexample,if,  an&itUemoftyp#e(Int,?Int,Int)&ismoGdTelled&bya9pGointla ttice,(2W
!", 
   
   cmsy1022)O!       cmsy7?,,  addinrgBjustonemoreInttotUhetupleeectivelydouUbleGsthela ttices#ize,giv-,  inrg[f(2畸222)?.Thecoqst sofhighe
rordTers1emÎanticanalys1eGsarealmoqst,  legendrary*,wkbutevenrstordTe
ranÎalys1eGscanb#ecomeexcesqs#ivelyexpensive.Get-,  tinrgreqasonÎablep#e
rformÎancesometimeGsrequires\wor klimitinrg"{tUhrowinrgaway,  dTetailUUwhichabqstractintUe
rpreta tionwouldotUhe
rwi#s1epickup.!@,  2
 Cons	trainfts onvia bٙledfe` s0 ignsW,  2.1Separaft"eTCompilat9ionW,  Cur*iouslyenough,s1epara tUecompilationi#stUhebiggeGsts#inrglesourceofdTes#ign,  constraint s.OAOconvenientOwaytroviewamUulti-moGduleprogrami#sasadirectUeGd,,  roGotUed,poqss#iblycyclicgraph,witUharcsre
ectinrgimpGortdTependencieGs,tUheMain,  moGduleGa ttUhe\trop",andtUheHaskellPreludea ttUhebGottrom^ٓR       cmr71|s.Compila tionofa,  moGdule.Mcaus1estUhecompile
rtroreqadthesourcetUextofMandintUe
rf#aceleGsof,  moGdulesimmedia tUelyb#elowM,andemitcoGdTeandintUe
rf#aceleGsforM.IntUe
rf#ace,  leGsareus1edbytUhecompile
rtrocommUunica tUereGsult sofs1emÎanticanalys1eGsacroqss,  moGdulebourndar*ieGs.IntUheabqs1enceofinformÎa tionabGourtimportUedentities,tUhe
re,  i#salwaysasafeasqsurmptionwhichcanb#emÎadTe.Thisf*ramewor kimpGoqs1ess1eve
ral,  limita tions:2@{=  ThetintUe
rf#aceleGsoughttrob#elimitUeGdtoareqasonÎables#ize,otUhe
rwi#s1etUhe=  compile
r\fmÎaysp#endalotoftimereqadinrgtUhem.F*orexample,GlasgowHaskell=  0.19's/PreludeintUe
rf#aceisabGourt100klong,andreqadingits#ignicantUlyslows=  compile
rUUstartupforsmÎallmoGdules.,  	ى  ff 8ϟ
L͍ -=)Aa       cmr61	?ItTi scon9venientTtoasNsum9eallmoAdulesTimporttTh9e1ߤN  	   	   cmtt9Prelude.                                         *^g\32\ܚX@{c  InformÎa tiononly
owsupwards,trowardsMain.F*orqueGstionsoftUheform  c  \hÎowQ6i#sentityXPgoinrgtob#eus1eGd?",wealsoneeGdinformÎa tion
owsdownwardc  f*romUUMain.X@{c  T*ocompileamoGduleM,itshÎouldsucetroreqadtUheintUe
rf#aceGsformodulesc  immeGdia tUelyb#elowM.W*ece
rtainlywanttroavoidreqadinrgalltUheintUe
rf#aceGsc  intUhedownwardcloqsureofM:forMain,tUha tcouldmeqanreadinrgtUheentirec  s1etUUofintUe
rf#aceGs.R  Mut9uallyrecur-s(ivemoQdules<;Exi#stinrgDimplementa tionsdTeqalwitUhmurtuallyR  recurs#ivecmoGdulescintwocways.Onei#strocompileallmoGdulescinagrouptro-R  getUhe
r,acleqansolurtion,aswitUhY*aleHaskell's\compila tionurnit s".TheotUhe
rR  i#sptrocompileeqachmoGduleintUhegroups1epara tUely*,urntilintUe
rf#aceleGsstabili#s1e,R  dTenotinrgLaxeGdpoint.Thi#smeqanstUha tatleqastonemoGdulewillhavetrob#eR  compileGd?NwitUhze
ros1emÎanticknowleGdgeoftUheotUhe
rs,witUhthecompile
rmÎak-R  inrg{worst-cas1easqsurmptions.TheupqshÎotoftUhi#sistUha t,fors1emÎanticanÎalys1eGsR  involvinrgUUxpGointing,UUtUhexpGoint sb#einrgcomputUeGdmÎayb#esuUboptimÎal.R  2.2CompJlet"eTorminim}alfunct9iongraphs?R  FixpGointinrg1]byminimÎalfurnctiongraphs^2	в(MFGs)buildstUheminimÎals1etofR  argurment-reGsult֌pairs
b> 
   
   cmmi10GneeGdTed֌troevqalua tUetUhexpGointa tasp#ecicargurmentR  xt}\       cmti7init
.c/Theinitialgraphi#sf(xinit
;>)g^3|s.AteqachitUe
ra tion,reGsulrt sforallargument sR  in4tUhecurrentgraphG	0er       cmmi7n	arere-evqalua tUeGd,givinrgGn+1.Whenanapplica tionofR  aAfurnctiontosomeargumentxi#sencountUe
reGd,tUheexi#stinrggraphGnji#ss1eqarcheGdR  forsacorreGspondinrgsresult.sIftUha txi#snotpreGs1ent,thereGsulrti#stakenas>andR  tUhe9pair(x;>)i#sins1e
rtUeGdintroGn+1.TheproGcesqs9rep#ea t surntilGstabili#s1eGs,R  whe
reupGonUUG(xinit
)dTelive
rstUherequireGdvqalue.Asanexample,cons#idTe
r:+D繍 #x ': 
   
   cmti10f Ѳ:: R[2_?2?
ظ!2_?2?
]Y #xfx Ѳ= R u 
   
   cmex108	  R<  R:d ?7sifB?x=? lift ز(lift(0)) ȸu㈲(lift(?)8t(fڧ?))7sifB?x=liftò(?) ظx㈸u(lift(?)8t(fڧx))7sotherwiseR  Givenxinitv=%_lift
(?),wehaveG0Ҳ=%_f(lift(?);>)g.Evqalua tinrg(f8lift.(?))giveGsR  reGsulrtlift ز(lift(0))4dandanewpair(?;>),soG1C=f(?;>);(lift(?);lift ز(lift(0)))g.R  ItUe
ra tinrg4againgiveGsG2
b=Kf(?;?);(lift(?);lift ز(lift(0)))g4ܲandG3
b=KG2|s,soR  G(xinit
)=liftò(lift(0)).a InDtUhi#sexample,therequireGdanswe
rwasobtaineGdbyevqalua tinrgfWa ttwoR  ourtofit sfourargumentpGoint s.WhentUheargurmentla tticeGscontaintUhÎousandsR  of]pGoint s,tUhehÎop#eistUha tonlyatinyminor*ityofargurment-reGsult]pairsneeGdtroR  b#eUUcompurtUeGd.a MFGsh>achieve\lazy"xpGointinrgb#ecaus1etUheymÎakeexplicittUhedTep#endenceR  b#etween?inpurtandoutʪputpGoint s.NoticehÎowtUhealgor*itUhmi#slimitUeGdtrorstR    ff 8ϟ
L͍ -=2	?ATfunct9ion'sgraphi snomoretThanacollectionofargument-reAsultTpairsforit.  -=3	?, 	   	   cmsy9>TifmaximalTxpAointfsaresough9t,?forminimalxpointfs.                                         @g\32\ܚ,  ordTe
r6furnctions:highe
rordTerxpGointinrgwouldrequirecompar*inrgcompletUefunc-  ,  tionrepreGs1enta tions,whichi#sprecis1elywha tlazyxpGointinrgi#sdTeGsignedtroavoid.,  Neve
rtUheleGsqs,byextUendinrgtUhenotionofdTep#endencyb#etweeninpurt sandourtʪput s,,  F*e
rguson	andHugheGs  [FH93!]havesucceGsqsfullygene
rali#s1eGdMFGstrowor kintUhe,  highe
rTordTercas1e,callinrgtUhemconcretUeda tastructureGs(CDSs),andRoqs1endrahl,  repGort sUUs#imilarresulrt s  [Roqs93j].; F*urnctionÎal6typ#eGsabqstracttrodomÎainswitUhsomanypGoint stUha tlazyxpGoint-,  inrgpcanmÎakeanenormousdie
renceforhighe
rordTeranÎalys#is.pF*ergusonand,  HugheGsUUgivegureGsfortUhef#amousfoldr-concatexample:;foldr?::(a->b->b)->b->[a]->b;foldr?fa[]=a;foldr?fa(x:xs)=fx(foldrfaxs);concat?::[[a]]->[a];concat?=foldr(++)[],  whe
reP(++)i#stUheHaskellli#st-appendPope
ra tror.PUsingPaBHA-styleforwardab-,  stractintUe
rpreta tion  [BHA85 []requireGsbuildinrganinstanceoffoldrintUhedo-,  mÎain=[4J!4!4]!4!6!4.Thi#sgiveGsanargurmentla tticeofalmoqst,  600,0001pGoint s.Compurta tion1oftUheentirefurnctiongraphtakeGsontUheordTe
r,  ofGanhÎourus#inrgtUhef*rontie
rsalgor*itUhm  [FH93!],whe
reqaswitUhCDSscompurting,  just#tUhÎoqs1epart sneeGdTed#trodetUe
rminetUheentirexpGointofconcattakeGstwoor,  tUhree	s1econdsurndTe
rs#imilarcircurmstanceGs.F*ormorecomplexfurnctionspaceGstUhe,  die
renceUUi#sevengreqa tUer.; Given"suchanove
rwhelminrgp#e
rformÎanceadvqantage,iti#stUemptinrgtofor-,  get entirelyabGourtanyotUhe
rxpGointinrgsTcheme.Y*etintUegra tionofCDS qbas1eGd,  xpGointinrg.+proves.+trouUblesome.+whenvieweGdf*romawidTe
rframewor k.The
reare,  twoas-yeturnreGsolvedi#sqsues.FirstUly*,asdi#sTcusqs1edb#elow,wehaveadTeepdeGs#ire,  troQavoidmonomorphicanÎalys1eGsofanykind.CDSsaspreGs1entUedsof#ararepurely,  monomorphic.;Becaus1eoftUheneeGdtrocloqs1elyexpoqs1edTep#endencies;b#etweensuUb-,  part softUheinpurtandsuUb-part softheourtʪput,iti#snotcleqarhÎowtUheymÎayb#e,  us1eGd,inapolymorphicway*.Forrst-ordTe
r,MFG-style,xpGointinrg,pGolymorph-,  i#smQisnotaproblem:KuUbiak  [KHL91"]hasimplementUeGdapolymorphicpro 8jection,  anÎalys1e
rUUwitUhMFGxpGointinrgintUheGlasgowHaskellcompile
r.; AmoreimmeGdia tUeproblemwitUhlazyxpointinrgi#shÎowtrodTeqalwitUhmoGdules.,  AdScrudTedWsTchemei#stroexpGortwha tUeve
rpart softUheabqstractfurnctiongraphhave,  b#een{Saggrega tUeGdwhilstcompilinrgtUhedTeningmoGdule.If,compilingsomeotUhe
r,  moGdule,tUhecompile
rneeGdstroknowtUhexpGointa tsomepGointforwhichno,  informÎa tioni#savqailable,iti#ssometimeGspoqss#ibletromÎakeasafeestimÎa tUeus#inrg,  monotronicityUUandtUheinformÎa tionwhichisavqailable.; F*or!example,havinrg!expGortUedGj=f(x1|s;fx1);(x2;fx2)g!wemÎaywi#shtro,  know`(fx3|s)intUhecas1ewhe
rex3	]v}x1	Ӳandx3	]v}x2|s.Sincefi#smonotronic,  itGGfollowstUha tfmx3ƸvZSfx1úandGGfx3ƸvZSfx2|s,andsofx3ƸvZS(fx1Vu+fx2|s).,  ProvidTeGd/wearewor kinrginaf*ramewor kwhe
reove
reGstimÎa tioni#ssafe,tUhisgiveGs,  anUUapproximÎa tUevqalueforfڧx3|s.                                         Vg\32\ܚa Cleqarly*,tUhebigge
rtheexpGortUedG,theb#ettUe
rtheeGstimÎa tUestUha tcanb#emÎadTe  R  f*romTit.BurttUhewhÎolepurpGoqs1eofMFGsi#strokeepGassmÎallaspGoqss#ible,R  containinrgp#e
rhapqsahandfulofpGoint sourtoftUhÎousandsofcandidra tUeGs.Thi#sR  milita tUeGs3OagainstmÎakinrggoodapproximÎa tions.3OW*ors1e,notalltUhepoint sinGR  mÎayb#eus1eGdinmakinrgtUheapproximÎa tion:intUheexampleabGove,wearelimitUeGdR  troUUus#ingpGoint sf(y[;fڧy)2G0jx3Cvy[ٸg.a A>s1econd,?!equallyurneGdifying?!solution?!i#stroexpGortnotonlyG,buttUhere-R  curs#iveGdomÎainequa tionf*romwhenceitcame{oreventUhesourcetUextwhichR  b#ega tdtUheequation.Then,whenGcannotanswe
raquery*,iti#sextUendTeGd,intUheR  mÎanne
r:dTeGsTcr*ib#edabove,:asrequireGd.IftUheabqstractintUe
rpreta tionsgetlarge,R  durmping/tUhemintrointUe
rf#aceleGsmÎaynotbepractical.ThissTcheme/alsohasaR  morexsuUbtleweqakneGss.xAhcrucialins#ighti#stUha tndinrgtUhexpGointofadomÎainR  equa tionmÎakeGsitstandonit sown:itnolonrge
rreferenceGsanyotUhe
requa tion.R  Cons#idTe
r͗tUhefollowinrgtUhreemoGdules͗dTeninrgrecurs#ivefurnctionsf,gandhwitUhR  correGspondinrgUUequa tionsf#,g#andh#:mamodule?F(f)where{D?f=...f...$}amodule?G(g)where{importF;g=...g...f...}amodule?H(h)where{importG;h=...h...g...}R  DurmpingUUtUheurnsolveGddomÎainequa tionsintrointUe
rf#ace(.hi)leGsgives:aF.hi:f#?=...f#...aG.hi:g#?=...g#...f#...aH.hi:h#?=...h#...g#...R  WhenmoGduleHi#scompileGditmÎaybeneceGsqsarytroextUendtUhefurnctiongraphR  forNg#.ThetrouUblei#sthi#smeqansreadinrgintUe
rf#aceF.hieventUhÎoughthetUextofR  moGduleHӲdo#esnotdirectUlyrefe
rtroF:ingeneral,itmightb#eneceGsqsarytroreadallR  intUe
rf#aceGs؍intUhedownwardcloqsureofH.AnysTchemewhichexpGort sintrointUe
rf#aceR  leGs՜refe
rencestrofunctionsinotUhe
rmoGdules՜sue
rstUhesameproblem.Mre
relyR  inlininrg?]refe
renceGstootUhe
requa tionsdo#eGsnothelp,astUhi#smÎakeGstUheintUe
rf#aceGsR  containUUeve
rytUhinrgb#elowtUhemintUhehie
rarchy*,andhenceve
rylarge:aF.hi:f#?=...f#...aG.hi:g#?=letrecf#=...f#.../?in...g#...f#...aH.hi:h#?=letrecf#=...f#.../?in letrec?g#=...g#...f#...
in...g#...h#...R  Becaus1eoftUheGsediculrtieGs,lazyxpointinrgdo#esnots1eemtrotwellinanR  environmentUUwhe
res1epara tUecompilationi#stUhenorm.mR  2.3P9oJlymorphicTorMonomorphic?R  Parametr*ic~VpGolymorphi#smisanimpGortantelementoftUhetyp#esystUemsofmoGdTe
rnR  furnctionÎalUUlanguageGs.Givenaparametr*icallypGolymorphicfurnction,wecould:                                         kJg\32\ܚ2@{=  ReGdotUheanÎalys#isforeqachdie
rentinstantia tionoftUhefurnction.Thi#sis  =  equivqalentߗtroexpandingouttUheprogramintoacollectionofmonomorphic=  instanceGsUUb#eforeanÎalysis.ٍ2@{=  AnÎalys1e&tUhefurnctiononce,andus1epGolymorphicinvqar*iancereGsulrt stodTeqal=  witUhUUdie
rentlyinstantia tUeGdus1esla tUe
ron.Q,  Anoft-quotUeGddi#sadvqantageoftUheforme
rapproachi#stUha tpGolymorphicfurnctions,  mÎayDb#eanalys1eGdmanytimeGs,whichi#swastUeful.IntUheworstDcas1e,tUhenUurm|qb#e
rof,  instanceGscanb#eexponentialintUhelenrgthoftheprogram.Neve
rtUheleGsqs,suchb#e-,  haviourtfdo#eGsnotappeqartrooGccur.Meqasurement sbyMar kJoneGsofs#ixsuUbqstantial,  programs6{intUhenofibsuitUe  [Par92q]suggeGstatwofoldincreqas1eintUhenUurm|qb#e
rof,  bindinrggroupqs  [Jon93].F*urtUhe
r,onlys#implelist-handlinrgfunctionslikemapand,  foldrShavealargenUurm|qb#e
rofinstanceGs,andsuchfurnctionsareoftUeninlineGdby,  optimi#sinrgcompile
rsanyway*.SomonomorphicanÎalys#ismaynotactuallyinvolve,  mUuch%duplica tionofwor k.Obqs1e
rvealsotUha ts#incetUheabqstractintUe
rpreta tionsof,  typ#eGsoftUenmÎapqsmanytyp#eGstrotUhesamela ttice,monomorphi#sa tionontUhebas#is,  ofUUla tticeGscaus1eGsevenlesqsexpans#ion.; Moreqs1e
r*iousi#s,onceagain,tUheintUeractionofmonomorphi#sa tionwitUhmoGd-,  uleGs.^RF*oramoduleM^Oexportinrgapolymorphicfurnctionf,wecaneGitUhe
ranÎalys1e,  fɲa talltUheinstanceGsitwillgetus1eda t,orwecanwaiturntilallmoGdulesaboveM,  arecompileGdandreqanÎalys1efonanas-neeGdTedbas#is.BotUhsTchemeGsareurnÎa ttract-,  ive,tUherstb#ecaus1eitrequireGsadownward(MaintroPrelude)pasqstUhroughthe,  moGduleggraphtroestabli#shginstantia tions,gtUhes1econdb#ecaus1eoftUheneeGdtrocarry,  arourndUUf'ssourcetUextwhencompilinrgmoGdulesUUaboveUUM.; Polymorphic\anÎalys#iscircurmvent sbGotUhproblemsb#ecaus1easinrgleanÎalysis,  s1e
rveGs[allquer*ieGs,eventUhÎoqs1efromdie
rentmoGdules.[W*or kbyBaraki,HugheGs,  andmLaurnchbury  [Bar93 ,HL92b!X](tromentionburtafew)haseGstabli#shedmtUech-,  niqueGs0#forbotUhforwardandbackwardpGolymorphicstr*ictneGsqsanÎalys1es.Back-,  ward%anÎalys1eGslendtUhems1elveGsparticularlywelltrosuchanapproach:Section5,  of  [Sew948]dTeGsTcr*ib#essuchananÎalys#isinconsidTe
rabledetail.Baraki'swor kindic-,  a tUeGshÎowsomeforwardanÎalys1eGsmayb#emadTepGolymorphic:  [Sew948],Section3,  dTeGsTcr*ib#esUUanimplementa tion.; F*ordrstordTe
rfurnctions,pGolymorphictUechniqueGsgivetUhesamereGsulrt sas,  monomorphic82anÎalys#is:tUheyareexact.Burtinthehighe
rordTercas1e,accuracy,  mÎayb#eloqst.F*orbackwardanalys1eGs,whichareinhe
rentUlyrst-ordTer,tUhi#smÎay,  b#eacceptable.F*orotUhe
ranÎalys1eGs,tUhemÎagnitudTeoftUhi#sproblemhasyettrob#e,  quantieGd.!<,  2.4High9eDrTorr-stTorder?<,  Highe
rordTerxpGointinrgi#sdicultb#ecaus1etUhela ttices#izeGsforfurnctionspaceGs,  grow8sorapidly*.Forexample,instr*ictneGsqsanÎalys#is,8anitUemoftyp#e[Int]?->[Int],  mightabqstracttrodomÎain[4\!4],whichhas35pGoint s.Addinrgas1econdpara-,  metUe
rooftUhesametyp#egiveGsdomÎain[4!4!4],owitUh24,696point s,anincreqas1e,  ofove
r700timeGs.ThenUurm|qb#e
rofpGoint sin[4v!4!4!4]i#sce
rtainlyve
ry                                         |	g\32\ܚR  large.oManyfurnctionÎalparametUe
rshavetyp#eGsmorecomplica tUedtUhanthi#s,and  R  calcula tinrgUUcompletUexpGoint sintUheGirpres1encei#simpractical.a FixpGointinrgbytUe
rmrewr*itinrgsometimeGsf#ailsintUhepreGs1enceoffurnctionÎalR  parametUe
rs. IntUhegene
ralcas1e,highe
rordTerequa tionscannotb#esolveGd,b#ecaus1eR  tUheGirxpoint sdTep#endontUhexpGoint softUhefurnctionÎalparametUe
rs.TheusualR  metUhÎoGd՛ofrewr*itinrgadjacentapproximÎa tionstronormÎalformf#ailstodTetUectanR  ove
rall`xpGointb#ecaus1esuUbqsequentapproximÎa tions`contain`sometUe
rminvolvinrgR  atfurnctionÎalparametUe
rapplieGdmoreandmoretimeGs.Thi#soccurs,forexample,R  inUUxpGointinrgforwardsabqstractionsoffoldr:Hٍafoldr#(n)=?\faxs->...f(f...(fE)...)...afoldr#(n+1)?=\faxs->...f(f(f...(fE)...))...R  whe
reEi#ssomearbitrarytUe
rm,andfoldr#(n)andfoldr#(n+1)dTenotUetwoR  adjacent1approximÎa tionstrotUhexpGoint.He
re,fi#safurnctionÎalparametUe
rb#eGinrgR  wrapp#eGdmoreandmoretimeGsarourndE,tUhe
reTbymÎakinrgsyntacticdTetUectionofR  axpGointimpoqss#ible.Ofcours1e,iftUhetUe
rmrewr*ite
ri#sextremelycleve
ritcanR  dTetUect#tUha t,forsomesuitablylargen,f \pnb=MxfR,soitcanreplacef3(xfڲ)byR  x`>1fhand-tUhe
reTbygene
ra tUenormÎalformswhichdTep#endexplicitUlyonf'sxpGoint.R  TheprequireGdpa ttUe
r#nmÎatchinrgpi#str*icky{notsosimplefordouUblyrecurs#iveR  tUe
rms_{andweneeGdtrodTecide_onasuitablen.ThevqalueofndTep#endsontUheR  furnctionܭspaceinqueGstion{cleqarly*,weneeGdaquickalgor*itUhmforgivinrgaR  goGodove
reGstimÎa tUeoftUhefurnctionspace'sheGight.NielsonandNielsonloGokeda tR  tUhi#sproblem  [NN92 ],burttheGirwor kcangiveexceGsqs#ivelylargeeGstimÎa tUesandi#sR  of[limitUeGdapplicability*.[A>morefurndamental[problemi#spGolymorphi#sm:intUha tR  cas1e,㾵nvqar*ieGswitUhtheinstantia tion,sotUhenotionofcompurtingas#inrglevqalueR  forUUiti#snons1ense.a Neve
rtUheleGsqs,forhigherordTerequa tionswhichdonotdTep#endontUhexpGoint sR  of1tUheGirfurnctionÎalparametUe
rs,te
rmbas1eGdxpointinrgwor kswellandcanb#eR  tUhÎousandsoftimeGscheqap#e
rtUhanus#inrgf*rontie
rs.Suchequa tionscanb#egene
ra tUeGd,R  for՞example,f*romtUheforwardsabqstractionsofmapandfilter([Sew948],SectionR  4.3.5).HٍR  Indefenceofr-stordeDran}alys(isThi#s%pape
rargueGsagainsthigherordTerR  anÎalys1eGs.^Whenmodulesarealsotaken^introaccount,tUhenurm|qb#e
rofdTeGsigncon-R  straint sb#ecomeGsintrole
rable.CansuchastUepb#ejustieGd?W*ell,takeninawidTe
rR  contUext,9:mÎayb#e.Highe
rordTerfurnctionsdTefeqa tadvqanceGdcodTegene
ra tion9:tUech-R  niqueGs,Zlikear*itycheckavoidrance,un|qbGoxingandargument sinregi#stUe
rs,ZsinceR  tUheyrepreGs1entcallstrocompletUelyunknownfunctions.Aqugust sqson  [Aug93]sug-R  geGst s>tUha tcallinrgaknownfurnctioncoqst shalfasmUuchascallinrganunknownR  one.a The(Haskell)compile
rcommUurnitygotrocons#idTe
rabletrouUbletrogetr*idofR  callsUUtrohighe
rordTerfurnctions.F*orexample:X@{c  Simple non-recurs#ivecom|qbinÎa trorslike(.)andthenSѲareinlineGd(inGlasgowc  Haskell).   	                                      g\32\ܚ2@{=  PreludTeuDfurnctionswhichpasqsfurnctionÎalparametUe
rsalonrgunchangeGd,uDlike  =  mapUUandfoldr,areurnfoldTeGdtoformsp#ecialis1eGdUUve
rsions(inY*aleHaskell).
E2@{=  Ove
rloadTeGdefurnctionsaresp#ecialis1eGda ttUheirus1einstances,a tleqastwitUhin=  s#inrglemoGdules(GlasgowandChalme
rs).Thi#savoidsagreqa tdTealoftUhe=  highe
ruGordTermÎachine
rywhichi#softUenasqsoGcia teduGwitUhimplementa tionsuGof=  ove
rloadinrg.ύ,  Nelan  [Nel91]dTeGsTcr*ib#esa tsomelenrgtUhtUechniqueGsforwha thetUe
rmeGdrstic-,  ation:ltUheaurtomÎa ticlremovqalofhighe
rordTerfurnctions.AltUhÎoughconve
rs#ionlof,  highe
r-ordTeriprogramstrorst-orde
rii#s,ingeneral,impGoqss#ible,iprogrammers,by,  and83large,us1ehighe
r-ordTer#neGsqs83ince
rtainidiomÎa ticwayswhichar}'eamenÎabletro,  rstica tionDus#inrgNelan'smÎachine
ry*.DThismÎachine
ry*,Dcom|qbineGdwitUhaggresqs#ive,  inlininrg,canb#eremÎar kablyeective.EvenwitUhÎourtus#ingrstica tion,mUuchof,  tUheUUoptimi#s1eGdcodTedeqalrtwitUhins#ideGlasgowHaskelli#spurelyrstordTe
r.; F*romAastr*ictneGsqsanÎalys#isApointofview,rstAordTe
ranÎalys#isAhastwomÎa 8jor,  advqantageGs:2@{=  FixpGointinrgi#seqasie
r.Thef*rontie
rsalgor*itUhmrurnsreqasonÎablyquicklyfor=  rstRordTe
rexampleGs  ([Sew948],Section3),andtUe
rmrewr*itebas1eGdxpointinrg=  i#sguarantUeeGdtrowor k.ComputingcompletUefunctiongraphsdo#eGsnotlook=  quitUesobadintUherstordTe
rcas1e,anddoinrgsomÎakeGsmoduleseqas#ie
rtro=  dTeqalUUwitUh.2@{=  Polymorphic6gene
rali#sa tiongiveGsexactresulrt s.MonomorphicanÎalys#isand=  it sUUa ttUendrantmoGdule-rela tUedUUproblemscanb#eavoidTeGdentirely*.%,  3
 Th e Defr9ive` dDes0 ign$Y,  3.1Ov9eDrview$Y,  Cons#idTe
r*inrgtUhedeGs#ignconstraint s,itlookslikearst-ordTe
r,polymorphicanÎa-,  lys#iscompurtingcompletUexeGdpoint smightformaplaus#iblebas#isforawor kinrg,  systUem,ksotUhi#siswha thasb#eenconstructUeGd.Aqbqstractinte
rpreta tionkproGduces,  tUe
rmsinwha tcanb#econsidTe
reGdtrobeanabqstractlam|qbGdra-calculus,andxpGoint-,  inrgHi#sdonewitUhatUe
rm-rewr*iteHsystemwhichtransformss1emÎanticallyequivqalent,  tUe
rmsUUtrosyntacticallyUUidTenticalUUnormÎalforms.; TheXanÎalys1e
rformspartoftUheGlasgowHaskellcompile
r,andop#e
ra tUeGsona,  dTeGsugaredHaskellformloGoqs1elyrefe
rredtroasCore.Coreallowslam|qbdratUe
rms,,  applica tions,alitUe
rals,loGcalbindinrgs,one-levelpa ttUe
r#nmÎatchinrga(cases)andcon-,  structrorapplica tions.Typ#einformÎa tionsupplieGdbypreviouscompile
rphas1eGs,  meqansftUhetyp#e(andhencetUheabqstractdomÎain)assoGcia tUedwitUheve
rysub#ex-,  preGsqs#ion(\isknown.TheCoretreei#sannota tUeGdwitUhthestr*ictneGsqsinformÎa tion,  compurtUeGd,^mÎakingitavqailabletrosuUbqs1equenttransformÎa tionpasqs1eGs,andtrotUhe,  intUe
rf#ace-pr*intinrgbmÎachinery*,bsootUhermoGdulesbcanknowabGourttUhestr*ictneGsqsof,  furnctionsUUintUhi#sone.   
                                      bg\32\ܚR  3.2Th9eTab s-tractint"eDrpretaftionR  Aqbqstract)intUe
rpreta tionsforstr*ictneGsqsanÎalys#ishavehi#stror*icallybeenca tUegor-  R  i#s1eGdBasforwardorbackward  [Hug90>],alrtUhÎoughtheapp#eqaranceofrela tionÎalana-R  lys1eGsi#snowblurr*inrgtUha tdi#stinction.BackwardanÎalys1eGsgene
ra tUeinformÎationR  abGourtfunctionargument sgivenknowleGdgeofsomeprop#e
rtyoftUheapplica tionR  asޛawhÎole.F*orexample,backwardޛstr*ictneGsqsanÎalys#isofann-argurmentfunctionR  proGducesH3nmÎapqs,oneforeachargurment,mÎappinrgdTemÎandonanapplica tiontroR  dTemÎandoneqachargurment.AstUhi#simplieGs,thefurndamentalabqstractentitieGsareR  pGoint sinla ttices,whe
redierentpGoint sdTenotUedie
rentdTemÎandsor\neeGdTed-R  neGsqs"forsomedra tastructure.Iti#susualtro(a tleqastpGotUentially)alloweqachR  die
rent*concretUetyp#etrohaveit sownla tticeofabqstractdTemÎands,inordTe
rtUha tR  weUUcandodTetaileGdanÎalys1eswitUhdra tastructureGs.PWa AlrtUhÎoughtherststr*ictneGsqsanÎalys1eswe
reoftUheforwardstyp#e,la tUe
rdTe-R  velopment{TsuggeGstUedbackwardsanÎalys#ismightbequicke
randgiveas#imple
rR  treqa tment$7ofpGolymorphi#sm,andpracticalwor ks1eemstrob#eqartUhisourt  ([Sew948],R  Section5).Thefewpap#e
rsshÎowinrghÎowstr*ictneGsqsinformÎa tioncanb#eus1eGdtroR  gene
ra tUec&b#etterc&coGdTe  [PJ93,Hal93G]alleitUhe
rsuggestorimplytUha tbackwardsR  informÎa tionF.i#swha ti#sactuallyus1eful.T*akentrogetUhe
r,tUhecas1eforbuildinrgaR  backwardsUUabqstractintUe
rpreta tions1eemsove
rwhelminrg.a Spaceblimita tionsprecludTemUuchdi#sTcusqsionoftUheabqstractintUe
rpreta tion.R  SuceittrosaytUha titi#sfairlyconventionÎal:tUheove
rallstructurei#ssimilartroR  tUha tpreGs1entUedbyJohnHugheGsin  [Hug90>],alrtUhÎoughthemechani#smfordTeqalinrgR  witUhdra tastructureGs,constructrorsandcas1etUe
rmsi#sdierent.AswitUhanypurelyR  backward
anÎalys#is,highe
r-ordTeranÎalys#isisimpGoqss#ible,sowenÎaivelyasqsurmetUha tR  allUUurnknownfunctionsdonotdTemÎandtUheGirargurment sa tall.a ManypbackwardabqstractintUe
rpreta tionsgotroagreqa tdTealoftrouUbletromoGdTelR  dra tastructureGswell,tUhe
reTbyinducinrgcons#idTe
rablecomplica tionintUhemÎachine
ryR  whichdTeqalswitUhdra tastructureGs{constructrorfunctionsandcases.F*orturnÎa tUely,R  tUheYpreGs1enta tioncanb#esimplieGdbytUheobqs1e
rvqa tiontUha t,providTeGdtUheabqstrac-R  tionnofcasesandconstructrorfunctionsob#eysce
rtainconstraint s,itdo#eGsn'tmÎa t-R  tUe
r<a tallwhattUheyare.Sothebackwardsabqstractioncanb#especieGdwitUhÎourtR  sayinrgiDanytUhingmUuchabGourtda tastructureGs.SuUbqs1equentparametUe
r*i#sa tionsofR  it?proGducecompletUe,wor kableabqstractintUe
rpreta tions,anddie
rentparamet-R  e
r*i#sa tions7canproGduceintUe
rpreta tionsgivinrgve
rydierentlevelsofdTetailforR  dra tastructureGs.Thi#smodularapproachandsomeparametUe
r*i#sa tionsofitareR  dTevelop#eGdUUin  [Sew948],Section5;weourtUlineonesuchparametUe
r*i#sa tionshÎortUly*.a An'impGortantfeqa tureoftUheabqstractioni#stUha tsuitableparametUe
r*i#sa tionsR  proGducepolymorphicallyinvqar*iantintUe
rpreta tions.Polymorphicinvqar*iancef#acil-R  ita tUeGss1eparatecompilation,asdi#sTcusqs1eGdinSection  2.3,anditalsomeqanstUhes#izeR  oftUe
rmsgenera tUeGdby(hence,tUhecoqstof )abqstractintUe
rpreta tioni#snotrela tUeGdR  tro6tUheinstantia tion.Thi#sisinmÎar keGdcontrasttro,forexample,W*adle
r'sor*iginalR  non-
a t*intUe
rpretation  [W*ad87 ],*inwhichabqstractionofcaseexpreGsqs#ionscouldR  gene
ra tUektermskwhÎoqs1es#izeGsgrowexponentiallykwitUhthes#izeoftheinstantia tinrgR  typ#eGs.a Backwards{str*ictneGsqsanÎalys1eswor k,inas1ense,bydTetUectinrgf*reevqariableGsin                                         g\32\ܚ,  expreGsqs#ions.Becaus1emostvqar*iableGsdonotapp#eqarf*reeinmostexpreGss#ions,a  ,  nÎaiveanalys#iswilltUendtrogene
ra tUemÎanyhUugetUe
rmswhichtr*iviallyreGducetro,  ?,htUhepGointdTenotinrgze
rodTemÎand.Still,gene
ra tinrgtUheGs1etUhinrgs,thenreGducinrg,  tUhem,takeGseort,anditproveGsvqaluabletroplantce
rtainkeyrewr*itUeruleGsins#idTe,  tUheaabqstractintUe
rpreterait s1elftros#idTeGstUeptUheprocesqs{atr*ivialmodica tiontrotUhe,  coGdTe.Incorpora tinrgfouroftUhemoqstpGopulars#implerewr*itUeruleGsdramÎa tically,  curt stUhes#izeofgene
ra tUeGdte
rmsandsoexpandstUheranrgeofsourcefunctionsfor,  whichUUabqstractintUe
rpreta tioncanb#edoneinreqasonÎabletime.p,  Th9eWHe ad-Str1ictParamet"eDr1i(saftionL۲Ournimplementa tionus1eGsapowe
rful,  parametUe
r*i#sa tiondTeGsigneGdtrogivedTetaileGdresulrt sfortUhevqastmÎa 8jor*ityofdra ta,  dTeclara tionsaHaskellprogramme
rcouldreqasonÎablyus1e.Thi#sisincontrast,  trotUheoftUen-limiteGdrangeoftyp#eGswhichotUhe
rimplementa tionscandTeqalwitUh,,  sometimeGsDjustli#st s  [HH91 ],sometimeGsDafulle
rranrgeofda tadTeclarationswhe
re,  constructrorargument smÎayb#eoneoftUhetyp#evqar*iableGs,orarecurs#ivecalltrotUhe,  typ#e,\	burtnotUhingels1e  ([Sew918],Section6).TheparametUe
r*i#sa tioni#sdTeGsigned\	tro,  dTetUect.heqadstr*ictneGsqs.W*ewantUeGdtromoveawayf*romtUheprotrotyp#estageand,  creqa tUeananÎalys#iswhich(1)giveGsus1efulinformÎa tionfor,eectively*,any(non-,  furnctionÎally-typ#eGd){codTef*ragment,and(2)gene
ra tUeGsinformÎationtrosuppGortall,  known[str*ictneGsqs-rela tUedtransformÎa tions{hencetUheneeGdforheqad-str*ictneGss.,  TheUreGsulrti#stUha ttUheparametUe
r*i#sa tioni#sra tUhe
rcomplica tUeGd,sowewilltryand,  conveyUUtUheeGsqs1entialidTeqaswitUhanexample.j; TheeparametUe
r*i#sa tiondTe
r*iveGsf*romBur#n'sidTeqaofevqalua tiontransforme
rs.,  [Sew918]Ipgene
rali#s1eGdtUhistrowor kforawidTe
rrangeofda tatyp#eGs,and  [Sew948],  furtUhe
rextUendTeGdittrodetUectheqad-str*ictneGss.Letuscons#idTe
rlist s.List sabqstract,  trotUhreecollectionsofpGoint s:bottrom(B),dTenotingnoevqalua tion,tUhes1etW[a],,  dTenotinrg7evqalua tiontroweqakheqadnormÎalform,andtUhen,ifaconscelli#spro-,  duceGd,|evqalua tionoftUherstelementwitUha,andtUhes1etS[a][b],dTenotinrg,  evqalua tion4oftUhecompletUestructureoftUheli#st,evqalua tionoftUherst4element,  witUhaandallthereGstwithb.IfwemoGdTelintUege
rswiththetwoevqalua trors0,  (no-evqal)UUand1(eval),tUhela tticefor[Int]b#ecomeGs:Y ?S[1][1] /$\ S[1][0]?S[0][1] /\/ W[1]?S[0][0] \/ ?W[0] ο| οBC?; F*orexample,W[1]i#saheqad-str*ictevqalua tror,evalua tinrgtoweqakheqadnormÎal,  form,
]andtUheheqadInttroGo,ifpoqss#ible.
]S[0][1]meqanevqalua tUetUheentireli#st,  structure,uandallIntsexcepttUherst.SuY(Structure)evqalua trorsmÎaintaintUhe,  heqad/non-head/elementdi#stinctionsotUha t,forexample,whenali#stisknowntro                                         g\32\ܚR  b#e*cdTemÎandeGdbotUhtroW[1]andS[0][1],weknowwecandTemÎandtUheli#sttro  R  S[1][1]ǲ(whichi#sW[1]t3S[0][1]%).InotUhe
rwords,tUhi#smeqanstUheheqad-elementR  informÎa tion.{onaW.q(WHNF)evqaluatror.{i#snot(neceGsqsar*ily)oblitUe
rateGd.{wheniti#sR  com|qbineGdUUwitUhanSevqalua tror.$a The sTchemegene
rali#s1eGsinseve
raldirections.Recurs#ivetyp#eGswitUhmorethanR  one.typ#evqar*iablearemoGdTelledwitUhthesameB/W/S.collectionofpGoint s,witUhR  tUhe(W(andS(pGoint scontaininrgmUultipleparametUe
r*i#sinrgpGoint s,ra tUhe
rthanjustR  ones8andtworeGsp#ectivelyaswitUhli#st s.La tticeGsfornon-recurs#ivetyp#eGsomittUheR  SupGoint s,burtareotUhe
rwi#s1eidTentical.ConstructrorsoftUenhave\constant"typ#eGsR  {$tUhÎoqs1enotmentioninrg$typ#evqar*iableGs{forargurment s,orhaveargurment sinR  whichtUhetyp#evqar*iableGsandrecurs#iveinstanceGsoftUhetyp#eapp#eqarbur*ieGdinsidTeR  arbitrarylevelsof\intUe
rveninrg"typ#eGs.ManyprogramsalsoemploymUurtuallyR  recurs#ivestypeGs.sAlltUhes1ecaseGscanb#ehandled,salrtUhÎoughtheymÎaketUhepreci#s1eR  dTetails<oftUheparametUe
r*i#sa tionra tUhe
rcomplica tUeGd.Thi#sparametUe
r*i#sa tion,andR  tUhusUUthedTe
r*iveGdintUe
rpreta tion,i#spGolymorphicallyinvqar*iant.UR  3.3FixpQoint9ingUR  OnceTweregardtUheourtʪputToftUheabqstractintUe
rpreterTasatUerminsome\abqstractR  lam|qbGdraY$calculus",andweknowwewanttrocomparesuchtUe
rmsfors1emÎanticR  equality*,Ƕits1eemsnÎa turaltroinveGstiga tUetUhepGoqss#ibilityǶofbuildinrgas1emÎantics-R  preGs1e
rvinrgtransformÎa tionengine.W*egiveonlytUhebareGstsurmmÎaryhe
re{forR  dTetails,UUs1ee  [Sew948],Section4.SomeimpGortantpGoint sare:DX@{c  T*e
rms+arebuilrtf*romasmÎalls1electionofconstructions.Lam|qbGdras,vqar*iableGsc  andBapplica tionsintroGduceandrefe
rtrovqar*iableGs,andapplyabqstractfurnctionsc  tUhusIformeGd.\ConstructionÎal"tUe
rmsdTenotinrg?,tUheliftinrgofsomeotUhe
rc  tUe
rmMandtuplinrgareus1eGdtobuildvqalueGsinliftUedandproductMla ttices,Mandc  tUhe
re=areacorreGspondinrg=s1etof\dTeGstructionÎal"tUe
rmswhichtUeGstlifteGd-la tticec  pGoint sfor?,urndoliftinrgs,ands1electcompGonent sf*romtupleGs.FinÎally*,joinsc  andUUmeet softUe
rmsarealloweGd.X@{c  TheLdtUe
rmsarestronrgly-typ#eGd,usinrgwha tamount stoanabqstractve
rs#ionc  oftUheMilne
r-Hindleytyp#esystUem.W*ell-formeGdtUe
rmsmUustb#ewell-typ#eGd,c  andAmUustalsob#emonotronicwithreGsp#ecttrotheGirf*reevqariableGs.Thetyp#ec  systUem[3incorpGora tes[3anotionofparametr*icpGolymorphi#sm.Theabqstractin-c  tUe
rpreterexploit stUhi#sbymÎappinrgpGolymorphi#smintUhesourceprogramontroc  pGolymorphi#smintUheabqstracttUe
rms,whichgiveGspolymorphicanÎalys#ises-c  s1entiallyUUforf*ree.X@{c  TheY3rewr*itUe
rprop#e
rconsist sofasTcheGdulinrgY3mechanism,Y3whichs1elect sre-c  dTexeGs6andapplieGsrewr*itUerulestrotUhem,andtUherewr*itUeruleGstUhems1elveGs.c  TheasTcheGdule
rdTetUermineGstUhereGductionordTe
r,whichhasamÎa 8jorb#eqar*inrgonc  p#e
rformÎance.ThereareabGourtftyruleGs,mÎanywitUhcomplexs#idTeconditions.c  SincetUheruleGsarecodTedinHaskell,tUheycanus1etUhefullpGowe
rofHaskellc  pa ttUe
r#n-mÎatchinrg.Therewr*itUe
ri#scomplica teGdsomewha tbytUheneeGdtropro-c  pGoga tUeaTandus1epartialknowleGdge(ie,i#s/isaTnot?)oftUhevqalueGsofsuUbtUe
rmsc  inUUordTe
rtroreqachnormÎalform.   
                                      g\32\ܚ,  MakingtTh9erewr1it"eDrwor2kwellfʲOnceanormÎalformhasb#eendTecideGdonand  ,  suitable.rewr*itUeruleGsgene
ra teGd,tUhe
rei#sstilltUhei#sqsueofhÎowtUheruleGsaretrob#e,  applieGd.Thi#sboilsdowntroaprobably-irreconcilablecon
ictb#etweeninne
rmoqst-,  rstcandourtUe
rmoqst-rstcrewr*itinrg.BotUhstra tUegieGswor kwellmUuchoftUhetime,,  burtbGotUhalsosue
rf*rompa thÎologicalintUe
ractionsb#etweentUe
rmsemitteGdby,  tUheabqstractintUe
rpreterandsomeoftUherewr*itUeruleGs.IntUheGs1ecaseGs,rewr*itinrg,  canptakeasmÎalltUe
rmandexpanditexpGonentiallytroagiganticintUe
rmeGdia te,  tUe
rmnb#eforeemployinrgsomeotUhe
rruletroshr*inkittoanotUhe
rsmÎalltUerm.The,  eectonp#e
rformÎanceisdisastrous.GettinrgroundtUhi#sproblemrequireGsahybr*id,  reGductionYstra tUegywhichtr*iestroavoidYknownpa tUhÎologicalcas1eGs.Thi#swor kswell,,  alrtUhÎough'dTecidingontUhesplitrequireGsagreqa tdTealofdTetaileGdinveGstiga tionintro,  tUheUUpreci#s1edynÎamicsofthereGductionsystUemasapplieGdtroreqali#sticwor kloads.; W*a tchinrgwtUherewr*itUe
ra twor kreveqaleGdanotUhe
rintUereGstinrg,but,inretroqsp#ect,,  urnsurpr*i#singƇfact:tUheabqstractintUe
rpreter'sƇ\voGcabulary"oftUe
rm-com|qbinÎa tions,  emittUeGdi#sparticularlylimiteGd.ThesamesmÎallcollectionofidiomsoGccursove
r,  andove
ragain.SomeoftUheGs1eidiomsareextremelycommon,burttUheyarealso,  quitUebig.Bigte
rmsareap#erformÎanceliability;cons#istUentUlysmÎallte
rmstendtro,  givemUuchb#ettUe
rpe
rformÎance.Tha tmakeGsita ttractivetrocapturesuchidioms,  insp#ecial,newtUe
rms,andadjusttUherewr*itUeruleGsaccordinrgly*.Thi#sshÎouldbe,  donespar*inrgly*,s#incetUhetUe
rmrewr*ite
rb#ecomeGscomplica teGdbyhavinrgtodTeqal,  witUhmulrtiplerepreGs1enta tionsoftUhesametUe
rm.Still,captur*inrgjusttwocommon,  idiomsliketUhi#shasgivenp#e
rformÎancegainsve
ryroughlyontUheordTe
rof25,  timeGsUUforsomeinpurt s.; Even?witUhthi#str*icke
ry*,?the?abqstractintUe
rpreter?cansometimeGs?emittUermsso,  largetUheyswamptUherewr*itUe
r.IntUhi#ssitua tionitishelpfultrodTevis1eawaytro,  prurnetUe
rmssotUhemoqstimpGortantinformÎa tioni#sretaineGd,whilstdramÎa tically,  shr*inkinrgtUhetUe
rm.Ofcours1e,dTeningwha tinformÎationi#simpGortantandhÎow,  safety.i#spreGs1e
rved.dTep#endsentirelyontUheabqstractintUe
rpreta tion.F*ortUhi#skind,  ofKstr*ictneGsqsanÎalys#is,Kiti#ssafetroreplaceanytUe
rmby?,s#ince?charactUe
r*i#s1eGs\no,  dTemÎand".ThesTchemeemployeGdprurneGstUe
rmsafte
rasp#ecieGddTeptUhofnestUed,  W8or[Sconstructionshasb#eens1een.ThisdTeptUh-bas1eGdprurning,whilstcrudTe,i#s,  f*requentUlyeective,burtdo#eGsnotwor kwellforve
rywidTe,shallowtUe
rms.F*urtUhe
r,  inveGstiga tionintrocleve
rerpruningstra tUegieGs,andtUheGirrela tionshiptrowidTening,,  couldUUb#ewortUhwhile.!,  3.4Int"eDrf(acingTtTh9eab s-tractint"eDrpreterTan9dxpQoint"er,  All<implementa tionwasdoneintUhelazyfurnctionÎallanrguageHaskell.Pe
rform-,  ance5KprolinrgreveqaleGdanimportantf#act:hÎowwelltUhesystUemasawhÎolewor ks,  dTep#endsmheqavilyonhÎowmUuchoftUheabqstractintUe
rpreter'smourtʪputtUhexpGointUe
r,  (hence,mtUherewr*itUe
r)neeGdstros1ee.IftUhexpGointUe
ri#sve
rycleve
ritmÎayignore,  moqstɦoftUheintUe
rpreter'sɦourtʪput.Buts#incewr*itingtUheintUe
rpreterɦinHaskell,  mÎakeGs"itdTemand-dr*iven,"cleve
r#neGsqsontUhexpGointUe
r'spartsaveGsagreqa tdTeal,  ofe(exp#ens1eintUheintUe
rpreta tionit s1elf.ItseemssafetrosaytUha tthep#e
rformÎance,  reGsulrt suHreportUedb#elowcouldneve
rhaveb#eenachieveGd,norevenapproacheGd,                                         g\32\ܚR  hadk7tUheintUe
rpreterk7b#eenwr*ittUeninastrictlanrguage,SML,forexample.F*utUhe
r  R  dTetailsUUareavqailablein  [Sew948],Section4.a The comment stUhreeparagraphsbackregardinrgidiomsandtUhetUe
rmrewr*ite
rR  b#elieamorefurndamentaldTeGs#ign
awwhichlimit sp#e
rformÎance:s1er*iousandR  extUens#iveQshar*inrgloqss1eGs.Theidiom-spottinrgtr*ickgiveGsbigp#e
rformÎancespeeGdupqsR  pr*imÎarilyb#ecaus1eitavoidsduplica tionofarbitrar*ilylargesuUbtUe
rms.ManyoftUheR  cas1eGs=oftUheabqstractintUe
rpreter=duplica tete
rmsindi#sTcr*iminÎa tely*.AlltUhi#spGoint sR  troaneeGdforexplicitshar*inrgintUe
rms:non-recurs#iveabqstractlets.MoGdifyinrgR  tUhetUe
rmrewr*ite
rtrowor kwitUhletssoundsleGsqstUhanstraightforward,soitmightR  b#ezuhelpfultrobGorrowkeyidTeqasf*romtUhecall-by-neeGdlam|qbdracalculusdTesTcr*ib#edR  in  [AFM^+95']].a GoGod>+p#e
rformÎancehinrgeGsongenera tinrg>+smÎalltUermsandkeepinrgtUhemsmÎallR  tUhroughÎourt/<theGirvqar*iousmÎanrglings.IdTeqally*,tUhes#izeoftheabqstractintUe
rpreter'sR  ourtʪputFshÎouldb#epropGortionalFonlytrotUhes#izeofthesourceprogram.Thi#sisR  probablyurnreqali#stic.Neve
rtUheleGsqs,dTes#igne
rsofabqstractintUe
rpreta tionswouldR  b#e>welladvis1eGdtrostr*ivetowards>tUhi#sgoal.Asanexample,PhilW*adle
r'sor*i-R  ginÎala"non-
a tstr*ictneGsqsanalys#isa"sTcheme  [W*ad87 ]gaveanintUe
rpreta tionofcaseR  expreGsqs#ionseHwhichexpandsexpGonentiallywitUhthes#izeofinstantia tinrgtyp#eGs.ThisR  rendTe
rsݕitimpracticalforallburttUhetinieGstprograms([Sew948],Section5.8).OurR  backwardsf*ramewor ki#spGolymorphicallyinvqar*iant,soitavoidstUha tparticularR  hÎorror,burtitstillhasplentyofpGotUentialforoptimi#sa tionus#inrgabqstractlets.R  ThevpGointoftUhi#sexampleistUha t,withalittlecare,muchvofthe\expGonentialnesqs"R  canUUb#eenrginee
reGdaway*,givinrgsuUbqstantialp#e
rformÎancebenet s. 7R  4
 Re` sul tsэR  4.1InTtTh9esm}allэR  The6wtUechnologydTeGsTcr*ib#edabove6wwasconstructUeGdins#idTeapurpoqs1e-builrtdTevel-R  opment-`f*ramewor k.Thef*ramewor ki#saquick-and-dirtyimplementa tionoftUheR  f*ront&partofacompile
rforanoverloadinrg-f*ree&suUbqs1etofHaskell,dTeGs#igned&troR  f#acilita tUeexpe
r*imenta tion.Ahigher-ordTerremovqaltransformÎa tionintUhestyleR  ofLNelan  [Nel91]allowsrst-ordTe
rLanÎalys1eGsofprogramsmakinrgsuUbqstantialLus1eR  ofhighe
r-ordTerfurnctions.AllanÎalys1eGswe
redonemonomorphically*,tromÎakeR  compar*i#sonwitUhaforwardintUe
rpreta tionf#aire
r.F*ortUhebackwardsanÎalys1eGs,R  ofLcours1e,tUhe
rei#snointr*insicreqasontrous1emonomorphicanÎalys#is.LF*ourinpurt sR  we
reUUus1eGd:gۍX@{c  avlTree:UUins1e
rtionofitUemsintroanAVLtree(44lineGs).X@{c  life:XLaurnchbury'simplementa tionofConway's\life"s#imUula tion(311lineGs).X@{c  fft:F*astfour*ie
rtransform,fromHartUel'sb#enchmÎar ksuite  [HL92a](421c  lineGs).X@{c  ida:UUSolveGstUhe15-puzzle,alsof*romHartUel'ssuite(728lineGs).M䍑a life,MfftandidaaresuUbqstantialinpurt s.QuotUeGds#izesareaftUe
rins1ertionofR  suitableipreludTefurnctions.TheymÎakesuUbqstantialus1eofhighe
r-ordTerifurnctions,                                        g\32\j ͍? ForwCards EvhalTrans wHeKadStr-qict  Z˶ProgramHLτ     ff     ff \Tim9eHLτ     ff gReAs idHLτ     ff     ff ܤTim9eHLτ     ff ReAs idHLτ     ff     ff!ETim9eHLτ     ffAReAs idYeP5  ff U1keavlTree(Lτ     ff     ff;V`9.58HLτ     ffc,1514HLτ     ff     ff 0.23HLτ     ff "3j 	   	   cmti9197HLτ     ff     ff ?0.27HLτ     ff 200	life(Lτ     ff     ff2d359.20HLτ     ff^11203HLτ     ff     ff 2.01HLτ     ff m628HLτ     ff     ff ?2.97HLτ     ff 615ޑfft(Lτ     ff     ff6b28.76HLτ     ffb!1473HLτ     ff     ff 6.38HLτ     ff j1473HLτ     ff     ff ?8.38HLτ     ff 
1524ޑida(Lτ     ff     ff6b920+HLτ     ffW[54000+HLτ     ff     ff 9.32HLτ     ff j1725HLτ     ff     ff ?7.70HLτ     ff 
1734:3,  TaCble1.P9e	rformanceofabNstractinte	rpreters(t9imeins.econds,reAs id؇enciesinKb9ytes).  ,  It9alici s.eAd2guresin9dicatep eNakres id؇enciesd؇en9edb9ypreprocesNs ingph9as.es,ratTh9e	rth9an,  a9bNstract>inte	rpretationorxpAointing.TheForwCardsanalys isofidadidnotcomplete,  ev9enTin54megabyteAsofheNap.",  which;vtUherstie
rhastrowor kquitUehardtroremove,andwhichcaus1eGstUheinpurtto  ,  tUhe7abqstractintUe
rpreter7prop#ertrob#econsidTe
rablybiggertUhantheurntransformeGd,  sourceGs.ꍑ; ThepNanÎalys1e
rwaswr*ittUeninstandrardHaskell1.2,compileGdwitUhGlasgow,  HaskellbS0.19\-O",andrurnonaquiet64-megabytUeSurnSparc10/31running,  SurnOSv4.1.3.vOAgene
ra tionÎalgarbagecollectrorwasus1eGd,andheqaps#izeGswe
re,  s1etyetrotryandkeepgarbagecollectioncoqst sb#elow10%,alrtUhÎoughforlarge
rreGs-,  idTencieGs.tUhi#sisdiculrt.TimeGsundTe
rs#ixtys1econdsareave
rageGdove
rs#ixrurns.,  TheyKfincludTetUhepreproGcesqs#inrgKftimesKfofpars#inrg,dTeGsugar*ing,typ#echecking,Kfmono-,  morphi#sa tiongandrstica tion,burtinnocas1edotUheGs1eexceed20%oftUhetrotal.,  T*able  1UUshÎowstUhereGsulrt s,us#ingtUhreedie
rentabqstractintUe
rpreta tions:2@{=  He adStr1ict:aheqadstr*ict,backwardsintUe
rpreta tionpreci#s1elyasdTeGsTcr*ibed=  inUUtUhi#spape
r.2@{=  Ev\ralT
rans:anotUhe
rbackwardsintUe
rpreta tion,formeGd,aswitUhHeqadStr*ict,=  us#inrg'ktUhegene
r*icframewor k'kdTeGsTcrib#ed'kabove,'kburtus#ingas#imple
rcharactUer-=  i#sa tionSofdratastructureGs,esqs1entiallyagene
rali#sa tionofGeoBur#n'sEvqalu-=  a tionUUT*ransforme
rs.2@{=  F
orw9ards:aforwardsBHA-styleintUe
rpreter,witUhhandlinrgofda tastruc-=  tureGstasdTesTcr*ib#edin  [Sew918].Thedra ta-structurehandlinrgcanb#econsidTe
reGd=  inUUas1enseUUof\equivqalent"dTetailtrotUha tofEvqalT*rans.,  EachintUe
rpreterwasmeqasureGdwitUharewr*itUe-bas1edxpointUe
rdTes#ignedsp#ecially,  forit.Therewr*itUe
rsareve
rys#imilar,andbyus#inrgtUhesamekindofoptimi#sa tions,  inUUeqachwehÎop#etromÎaketUhecompar*i#sonreqasonÎablyf#air.; TheGs1e1meqasurement smÎakecleqarjustwha tanadvqantagetUhebackwardsintUe
r-,  preta tions/have{tUheEvqalT*ransanÎalys#isofliferurnsalmoqsttwohUurndreGdtimeGs,  f#astUe
r6tUhantheforwardsanÎalys#is,6andinaf*ractionoftUhespace.TheHeqadStr*ict,  intUe
rpreta tion-i#snotsignicantUlyslowe
r-than-the-EvqalT*ransve
rs#ion.ThiscomeGs,  as'abitofasurpr*i#s1e,sinceonemightexp#ectittroproGducemUuchmoredTetail,,  andltakecorreGspondinrglylonge
r.Insp#ectionofoutʪput sreveqalstUha titdo#eGsn't,  alwaysapndagreqa tdTealmorestr*ictneGsstUhantheEvqalT*ransanÎalys#is.AndquitUe                                        *.g\32\ܚR  whytUheHeqadStr*ictanÎalys#isshÎouldsometimeGsb#equicke
r(forida)i#smystUe
r*ious,  R  pGoqss#iblyUUduetrotUhepreci#s1edTetailsofreGductionpa tUhsinthetUe
rmrewr*ite
rs.qmR  4.2InTtTh9elargeqmR  AftUe
rextens#iveturningintUhedTevelopmentf*ramewor k,tUhe(pGolymorphic)Heqad-R  Str*icty}intUe
rpretery}andit sxpGointUerwereinstalleGdinGlasgowHaskell0.19troR  asqs1eGss+tUheviabilityofsuchstr*ictneGsqsanÎalys#is+\intUhelarge".IntUegra tionaddTeGdR  abGourt5700non-blank,non-commentlineGsofcodTetroanexi#stingtotalofabGourtR  50000.]Becaus1etUhecompile
ri#swelldTeGs#igned,]intUegra tionwasremÎar kablycleqan,R  witUhthesmÎalleGstofmodica tionstroexi#stinrgcoGdTe.Theexi#stinrgf*ramewor kforR  transmittinrg=-pragmÎa ticinformÎa tionb#etweenmoGdules=-wasextUendTeGdtroallowfullR  intUe
rmoGdule\anÎalys#is;giventUheargurment spreGs1entUed\inSection  2,tUheexp#e
r*imentR  wouldUUhaveb#eenlargelywortUhleGsqshadtUhi#sbeenomittUeGd.a CompilinrgGlasgow'simplementa tionoftUheHaskellPrelude,plussomeotUhe
rR  gene
ral-purpGoqs1eIlibrar*ies,trotallingabGout4000lineGs,takeGssomefourhÎoursonaR  SurnSparcSta tionIPX,roughlyadouUblinrgoftheno-anÎalys#istime.Aheqaps#izeR  ofbT24megabytUeGsbTprovedbTmoretUhanadTequa tUe,and,pleqas#inrgly*,tUhe
rewasnoneeGdR  troĳreGsorttotUhetree-pruningdTeGsTcr*ib#edĳinSection  3.3.Aneqarlie
rve
rs#ionoftUheR  anÎalys1e
r,sinit sdTevelopmentsf*ramework,sconstiturtings13000lineGsin28modules,R  wassuUbqs1equentlycompileGd.25moduleswenttUhroughwithnoproblems,whilstR  tUhreeUUrequireGdprurning.a Byt7anystandrards,suchexp#e
r*imenta tionwitUhreqalcompile
rsandreqalpro-R  gramsglendsmÎa 8jorcreGdibilitytrotUheenrginee
r*inggdTeGsTcrib#edgintUhispape
r.Ob-R  s1e
rvqa tion\oftUheintUe
rpreter\andxpGointUergrapplinrgwitUhnon-toyinput sleqadtoR  mÎany5Hrenement s,andtrotUhesuggeGstionsforfurtUhe
rdTevelopmenttrowardstUheR  endUUofSection  3.4.R  4.3Conclus(ionsqmR  The`abqstractintUe
rpreter`andxpGointinrgmechani#smourtUlineGdabGovehaveb#eenR  dTevelop#eGdXandturneGdbyrurnningtUhemove
rapproximÎa tUelytwentytUhÎousandlineGsR  ofQHaskellsourcecoGdTe.Asqs1ess#inrgQtUheviabilityofnewsTchemeGsonlyonsmÎallex-R  ampleGsorus#inrgpape
ranÎalys1eGscanbemisleqadinrg.GoGodenginee
r*ingrequireGsnotR  onlyFsuppGortinrgtUheory{ofwhichtUheeldshÎowsnoshÎortage{burtalsoextUens-R  ive8quantita tiveanÎalys#isonreqalistic-sizeGdinpurt s.Therela tivelackofeectiveR  implementa tionsIofstr*ictneGsqsandotUhe
rs1emÎanticanÎalys1eGsforHaskellhighlight sR  tUheUUneeGdforfurtUhe
ra ttUentiontroenginee
r*ingi#sqsueGsinabstractintUe
rpreta tion.a Us#inrgYtUheGs1epr*inciples,apolymorphicpro 8jectionanÎalys1e
rforHaskellhasb#eenR  creqa tUeGd.TheanÎalys1e
ri#seective,robust,reliable,tur#nsingoGodpe
rformÎances,R  andhasb#eenus1eGdtrosuppGortres1eqarchinaurtomÎa ticstr*ictica tionofHaskellR  programs^4|s.QItalsolaysourtadTeGs#ignwitUhconsidTe
rablepGotUentialforrenement,R  particularlywitUhreGsp#ecttrobuildingmoreeconomicalabqstractintUe
rpreta tions,R  andGtroxingshar*ingproblemsintUhexpGointinrgmechani#sm.F*urtUhe
rdTevelopmentR  mÎayUUyieldimpreGsqs#ivestr*ictneGsqsandshar*inrganÎalys1eGsforHaskell.R    ff 8ϟ
L͍ -=4	?Deni sTHo9we,DepartmentofComputing,TImp e	r'xialCollege,Lon9don.                                        A	g\32\ܚ,  Refefrence` s#f,  [AFM-=+n95]ZxZena'Ar'xiola,Mat3tThiasF:elleAi s.en,JohnMaraist,Mart9inOd؇e	rsky:,an9dPhilip  XaW:adle	r.MAocall-b9y-neeAdlamPbdacalculus.MIn22ndUSymposiumonPrinciplesXaof6ProgrammingLanguages,SanF:ranci s!co,California,JanTuary1995.A9CMXaPreAsNs.,  [A|rug93]XaLennartLA|rugustfsNson.Implem9entinghaskellove	rloading.InProceedings۹ofXatheFJunctionalProgrammingLanguagesandComputerAÎrchitectureConfer-Xaence,N<Copenhagen,Denmark,TJun9e1993.,  [Bar93]XaGe؇breAs.elasNs ieBaraki.gAÎbstract1InterpretationofPolymorphicHigher-OrderXaFJunctions.PhDtTh9eAs is,DepartmentofCompute	rScience,Unive	rs ityofXaGlasgo9w,MLilybankGard؇ens,GlasgowG128QQ,UK,F:e؇bruary1993.fAlsoXaa9v|railableTasaGlasgo9wT:echRepAortFP-93-07.,  [BHA85]XaG.L.nBur n,C.L.Hankin,an9dS.  A|rbramsky:.+ThetTheoryofstr'xictneAsNsanalys isXafor}high9e	r-ord؇erfunct9ions.&4InProceedingsRoftheWorkshoponProgramsRasXaDataObjects,UpageAs42{62,DIKU,Co9p enhagen,UDenmarfk,17{19Octobe	rXa1985.TSpr'xinge	r-V:erlagLNCS217.,  [CC78]XaCousotan9dCousot.CStaticd؇ete	rminationofdynamicprop e	rtieAsofrecurs iveXaproAced9ures.(vInE.J.Neuhold,eAditor,FJormalDescriptionofProgrammingXaConcepts.TNortTh-Hollan9d,1978.,  [Con91]XaCh9arleAsCons.el.F:aststr'xictn9eAsNsanalys isviasymPbolicxpointite	rat9ion.Un-XapuTbli sh9eAd.}Y:aleUnive	rs ity:,DepartmentofCompute	rScience,SeptemPb e	rXa1991.,  [FH93]XaAlexQF:e	rgusonan9dJohnHugheAs.F:astabNstractinte	rpretationus ings.equen-Xat9ial\algor'xitThms.InProceedingsoftheChalmersProgrammingMethodologyXaGroupWinterMeeting,jJanTuary1993.UDepart9mentjofCompute	rScienceAs,XaCh9alme	rsTUnivers ityTofT:ec9hnology.,  [Hal93]XaCord؇elia  V.ZHall.KUs ingstr'xictn9eAsNsanalysisinpract9icefordatastructureAs.XaIn{John  T.O'Donn9ellandKevinHammond,eAditors,GlasgowWorkshopXaonFJunctionalProgramming,wW:orfksho9pNsinComputing,wAyr,ScotTland,JulyXa1993.TSpr'xinge	r-V:erlag.,  [HH91]XaSe؇bast9ianHuntandChr'xi sHankin.FixeAdpointfsan9df'xront9ie	rs:anewp e	r-Xasp ect9ive.
Journal0SofFJunctionalProgramming,1(1):91{120,JanTuary1991.,  [HL92a]XaPiete	r  H.Hartelan9dKo en  G.Langendo en.	BenchmarfkingimplementationsXaof(flazyfunct9ionallanguageAs.MT:ec9hnicalreport,Depart9ment(fofCompute	rXaSystems,F:acult9yofMatThematicsandCompute	rScience,Unive	rs ityofAm-Xaste	rdam,TDecemPb er1992.,  [HL92b]XaJohn Hugh9eAsandJohnLa3unchbury:.	Pro jectionsforpAolymorphicrst-Xaord؇e	rstr'xictn9eAsNsanalys is.InMathematical9StructuresinComputerScience,Xav9olume  2,TpageAs301{326,1992.,  [HM94]XaC.  L.B9Hankinan9dD.LeMXet9aye	r.Der'xivingB9algoritThmsfromt9yp einfe	renceXasystems:(A|rp9plicationtostr'xictneAsNsanalys is.InProceedingsofPOPL'94,Xa1994.,  [Hug90]XaJohnHugh9eAs.Compile-timeanalys isoffunct9ionalprograms.InDavid  A.XaT:ur n9e	r,
eAditor,ResearchxTJopicsinFunctionalProgramming.
Addi son-XaW:eAsleyDPuTbli shingCompan9y,1990.ϮFromtTh9e1987YeNarofProgramming,XaUniv9e	rs ityTofT:exas,A|rust9in,T:exas.,  [Hun91]XaSe؇bast9ianHunt.2AÎbstractInterpretationofFJunctionalLanguages:FJromXaTheory?ftoPractice.'PhDtTh9eAs is,Impe	r'xialCollege,Univ9ers ityofLondon,Xa1991.                                        W+g\32\ܚR  [JM86]~aNeAil  D.Jon9esan9dAlanMycroft.pData
owanalys isofap9plicativeprograms  ~aus ingminimalfunct9iongraphs:A|rbr'xidgeAdve	rs ion.InThirteenthAÎCMSym-~aposium/onPrinciplesofProgrammingLanguages,St.Petersburg,Florida,~apageAsT296{306,1986.R  [Jon93]~aMarfk  P:.LJon9eAs.Partialev|raluationfordictionary-f'xreeove	rloading.T:echnical~aRepAortRR-959,Depart9mentofCompute	rScience,Y:aleUniv9ers ity:,A|rpr'xil~a1993.R  [KHL91]~aR.  K9uTbiak,J.HugheAs,andJ.  La3unchbury:.nAprototyp eimplementationof~apro ject9ion-bas.eAdrst-ord؇e	rpAolymorphicstr'xictn9eAsNsanalys is.RInR.  Heldal,~aeAditor,RDraftrProceedingsofFJourthAÎnnualGlasgowWorkshoponFunc-~ationalN<Programming,TpageAs322{343,Sky9e,A|rugust13{151991.R  [Mar92]~aChr'xi sto9phe	r  CharleAst6Martin.4AÎlgorithmsmforFindingFixpointsinAbstract~aInterpretation.PhDtTh9eAs is,Impe	r'xialCollege,Univ9ers ityofLondon,June~a1992.R  [Nel91]~aGeorge  C.TNelan.Firstication.PhDTatTh9eAs is,Ar'xizonaSt9ateUnive	rs ity:,1991.R  [NN92]~aF.  NielsonDan9dH.R.Nielson.FiniteneAsNsconditionsforxeAdpointite	ra-~at9ion.|T:echnicalgrepAort,Compute	rScienceDepart9ment,gAarhTusUniv9ers ity:,~aDenmarfk,TF:e؇bruary1992.R  [NoAc93]~aEr'xic֓NoAc9ke	r.StrictneAsNs֓analys isusinga9bNstractreAduction.InProceedingsof~aFPCA93,N<Copenhagen,Denmark,TJun9e1993.R  [P9ar92]~aWill/P9artain.cThenofibb enchmarfksuiteofhaskellprograms.cInFifth~aAÎnnualN<GlasgowWorkshoponFJunctionalProgramming,N<Ayr,T1992.R  [PC87]~aSimonP9eytonJoneAsandChr'xi sClack.FindingxpAointfsinabNstractinte	r-~apret9ation..InVkS.  A|rbramskyan9dC.L.Hankin,eAditors,AÎbstractInterpretation~aofR`DeclarativeLanguages,0kCompute	rsan9dTheAirA|rpplications,chapte	r  11,~apageAsT246{265.Elli sHorw9ood,1987.R  [PJ93]~aWillnP9artainandSimonL.  PeytonJoneAs."EMeNasur'xingtTh9eeectiveneAsNsofa~as impleastr'xictn9eAsNsanalys.e	r.InJohn  T.O'DonnellandKevinHammond,eAd-~aitors,@&GlasgowuWorkshoponFJunctionalProgramming,W:orfksho9pNsinCom-~aput9ing,TAyr,ScotTland,July1993.Spr'xinge	r-V:erlag.R  [RoNs93]~aMadsRoNs.en9dahl.+2Highe	r-ord؇erchaoticite	rations.equenceAs.+2InPLILP'93,~apageAsT332{345,T:allinn,Estonia,1993.Spr'xinge	r-V:erlagTLNCS714.R  [Sew91]~aJulian+Sew9ard.WT:owardsastr'xictneAsNsanalys.e	rforhaskell:Put3ting+tTheory~aintopract9ice.Maste	r'stTheAs is,Unive	rsityofMancheAste	r,Departmentof~aCompute	rScience,1991.Av|raila9bleasUnive	rs ityofMancheAste	rT:echnical~aRepAortTUMCS-92-2-2.R  [Sew94]~aJulian)Sew9ard.AÎbstractLInterpretation:A-QuantitativeAssessment.PhD~atTh9eAs is, DepartmentofCompute	rScience,Unive	rs ityofMancheAste	r,Oxford~aRoad,TManc9heAste	rM139PL,UK,Octob er1994.R  [W:ad87]~aP:.L.Wadle	r.eStr'xictn9eAsNsanalys isonnon-
atdomains(b9yabNstractinte	rpret-~aat9ionove	rnitedomains).InS.  A|rbramskyandC.L.Hankin,eAditors,AÎb-~astract+InterpretationofDeclarativeLanguages,c9hapte	r  12,pageAs266{275.~aElli sTHorw9oAodLtd.,Chic9heAste	r,W:estSusNs.ex,Englan9d,1987.K3gR  Thi sTart9iclewasproAcesNs.edTus ingtTheL5A TuAEXmacropackagewitThLLNCSstyle k;    g\  3j 	   	   cmti91ߤN  	   	   cmtt9, 	   	   cmsy9)Aa       cmr6(N       cmbx12&t: 	   	   cmbx9%o 	   	   cmr9t}\       cmti7 ': 
   
   cmti10<x 
   
   cmtt10"V 
   
   cmbx10K ff ff cmbx14
!", 
   
   cmsy10O!       cmsy7
b> 
   
   cmmi10	0er       cmmi7K`y 
   
   cmr10ٓR       cmr7 u 
   
   cmex10 