HsTypeMaps is imported by: BaseSyntaxMaps.

-- $Id: HsTypeMaps.hs,v 1.11 2004/12/03 07:49:43 hallgren Exp $ --- Maps for the T functor -----------------------------------------------------

moduleHsTypeMapswhereimportHsTypeStructimportAccList(accList)importMUtilsmapTIidf=mapTI2idfidfmapTI2::(i1->i2)->(i1->i2)->(t1->t2)->TIi1t1->TIi2t2mapTI2vfcftfty=casetyofHsTyFunxy->HsTyFun(tfx) (tfy) -- HsTyTuple ts -> HsTyTuple (map tf ts)HsTyAppfx->HsTyApp(tff) (tfx)HsTyVarnm->HsTyVar(vfnm)HsTyConnm->HsTyCon(cfnm)HsTyForallxspst->HsTyForall(mapvfxs) (maptfps) (tft)mapT=mapTIidcrushTtf(HsTyFunxy)=tf[x,y] --crushT tf (HsTyTuple ts) = tf tscrushTtf(HsTyAppfx)=tf[f,x]crushTtf(HsTyVarnm)=tf[]crushTtf(HsTyConnm)=tf[]crushTtf(HsTyForallxspst)=tf(ps++[t]) -- not sure if that's right /ISD /TH -- ********** IMPORTANT ************* -- Several functions of typechecking (generalization in particular) depend -- upon the fact that seqT , accList, and accT visit nodes in order from -- LEFT-TO-RIGHT, If this is changed several things will not work correctly. -- YOU HAVE BEEN WARNED !!! -- After talking to Mark, it seems that it is only important that the order is -- consistent between application of the various functions to types.seqTIty=casetyofHsTyFunxy->HsTyFun#x<#y-- HsTyTuple ts -> HsTyTuple # sequence tsHsTyAppfx->HsTyApp#f<#xHsTyVarnm->HsTyVar#nmHsTyConnm->HsTyCon#nmHsTyForallxspst->HsTyForall#sequencexs<#sequenceps<#t--seqT :: (Functor m, Monad m) => T (m t) -> m (T t)seqTx=seqTI.mapTIreturnid$xaccTIidftfty=casetyofHsTyFunxy->tfx.tfy-- LEFT-TO-RIGHT here -- HsTyTuple ts -> accList tf tsHsTyAppfx->tff.tfxHsTyVarnm->idfnmHsTyConnm->idfnmHsTyForallxspst->tft.accListtfps.accListidfxsaccT=accTI(currysnd)

Index

(HTML for this module was generated on 2006-08-12. About the conversion tool.)