Ticket #36: HaRe_20012006_ghc68.patch

File HaRe_20012006_ghc68.patch, 13.0 KB (added by bhuber, 5 years ago)

Patch for compiling HaRe?_20012006 on ghc-6.8.2

  • StrategyLib-4.0-beta/library/MetricsTheme.hs

    diff -ur HaRe_20012006_orig/StrategyLib-4.0-beta/library/MetricsTheme.hs HaRe_20012006/StrategyLib-4.0-beta/library/MetricsTheme.hs
    old new  
    1313module MetricsTheme where 
    1414 
    1515import Monad 
    16 import Data.Monoid as Monoid 
     16import Data.Monoid as Monoid  
    1717import StrategyPrelude 
    1818import OverloadingTheme 
    1919import FlowTheme 
     
    2121------------------------------------------------------------------------------ 
    2222-- * An abstract datatype for metrics 
    2323 
    24 -- | The type of metrics 
    25 type Metrics            =  MetricName -> Integer 
     24-- | The type of metrics (changed to newtype to avoid overlapping) 
     25newtype Metrics                 =  Metrics (MetricName -> Integer) 
    2626 
    2727-- | The type of metric names 
    2828type MetricName         =  String 
    2929 
    3030-- | Create 'Metrics' with given initial value for all metrics. 
    3131initMetrics             :: Integer -> Metrics 
    32 initMetrics n           =  \key -> n 
     32initMetrics n           =  Metrics $ \key -> n 
    3333 
    3434-- | Create 'Metrics' with 0 as initial value for all metrics. 
    3535initMetrics0            :: Metrics 
     
    4141 
    4242-- | Increment metric with the given name with the given value. 
    4343incMetrics              :: MetricName -> Integer -> Metrics -> Metrics 
    44 incMetrics key n m      = \key' -> let val = m key'  
     44incMetrics key n (Metrics m)    =  Metrics $ \key' -> let val = m key'  
    4545                                    in if key'==key then val+n else val 
    4646                                     
    4747-- | Increment metric with the given name by 1. 
     
    5050 
    5151-- | Print value of metric with the given name. 
    5252putMetricLn             :: MetricName -> Metrics -> IO () 
    53 putMetricLn key m       =  putStrLn $ key++" = "++show (m key) 
     53putMetricLn key (Metrics m)     =  putStrLn $ key++" = "++show (m key) 
    5454 
    5555 
    5656 
    5757-- * Metrics as monoids  
    5858instance Monoid Metrics where 
    5959  mempty        = initMetrics0 
    60   mappend m1 m2 = \s -> (m1 s) + (m2 s)  
     60  mappend (Metrics m1) (Metrics m2) = Metrics $ \s -> (m1 s) + (m2 s)  
    6161 
    6262 
    6363------------------------------------------------------------------------------ 
  • StrategyLib-4.0-beta/models/drift-default/TermRep.hs

    diff -ur HaRe_20012006_orig/StrategyLib-4.0-beta/models/drift-default/TermRep.hs HaRe_20012006/StrategyLib-4.0-beta/models/drift-default/TermRep.hs
    old new  
    6565getChildren (TermRep (_,ks,_))   = ks 
    6666getConstr   (TermRep (_,_ ,c))   = \ks -> TermRep (c ks,ks,c) 
    6767getTypeRep t                     = typeOf t 
    68 hasTypeOf (TermRep (dx,_,_)) (x::t) 
    69   = ((fromDynamic dx)::Maybe t) 
     68hasTypeOf :: Typeable t => TermRep -> t -> Maybe t 
     69hasTypeOf (TermRep (dx,_,_)) x 
     70  = (fromDynamic dx) 
    7071 
    7172 
    7273--- Instances for basic types and basic type constructors -------------------- 
  • diffs/tools/base/Modules/Relations.lhs

    diff -ur HaRe_20012006_orig/diffs/tools/base/Modules/Relations.lhs HaRe_20012006/diffs/tools/base/Modules/Relations.lhs
    old new  
    11>module Relations where 
    22 
    3 >#if __GLASGOW_HASKELL__ >= 604  
     3#if __GLASGOW_HASKELL__ >= 604  
    44>import qualified Data.Map as M 
    55>import qualified Data.Set as S 
    66 
     
    1818>   add fmap (key,elt) = M.insertWith combiner key elt fmap 
    1919 
    2020>findWithDefault a k fm = M.findWithDefault a k fm 
    21 >#else 
     21#else 
    2222>import qualified Data.FiniteMap as M 
    2323>import qualified Sets as S 
    2424 
     
    3232>difference = S.minusSet 
    3333>addListTo_C combiner fm key_elt_pairs = M.addListToFM_C combiner fm key_elt_pairs 
    3434>findWithDefault a k fm = M.lookupWithDefaultFM fm  a k 
    35 >#endif  
     35#endif  
    3636 
    3737 
    3838Relations 
  • diffs/tools/base/defs/UniqueNames.hs

    diff -ur HaRe_20012006_orig/diffs/tools/base/defs/UniqueNames.hs HaRe_20012006/diffs/tools/base/defs/UniqueNames.hs
    old new  
    7676  ppiOp (PN i n) = ppiOp i<>n 
    7777 
    7878instance Printable Orig where 
    79   ppi (D n (N s)) = ppi (subnum n)<+>ppIfDebug ("«"<>s<>"»") 
    80   ppi (S p) = ppIfDebug ("«"<>p<>"»") 
    81   ppi (G m _ _) = ppIfDebug ("«"<>m<>"»") 
    82   --ppi (Sn n (SrcLoc f r c)) = "«"<>r<>","<>c<>"»" 
     79  ppi (D n (N s)) = ppi (subnum n)<+>ppIfDebug ("<<"<>s<>">>") 
     80  ppi (S p) = ppIfDebug ("<<"<>p<>">>") 
     81  ppi (G m _ _) = ppIfDebug ("<<"<>m<>">>") 
     82  --ppi (Sn n (SrcLoc f r c)) = "<<"<>r<>","<>c<>">>" 
    8383  ppi _ = empty 
    8484 
    8585subnum n = ppIfUnicode (subdigs (show n)) n 
  • refactorer/EditorCommands.hs

    diff -ur HaRe_20012006_orig/refactorer/EditorCommands.hs HaRe_20012006/refactorer/EditorCommands.hs
    old new  
    1212         ,Handle 
    1313         ,stdin 
    1414         ,stderr) 
    15 import Control.Exception as Exception 
     15import Control.Exception as Exception hiding (bracketOnError) 
    1616import Foreign 
    1717import Foreign.C 
    1818import Network hiding (listenOn,connectTo,accept) 
  • refactorer/PFE0.hs

    diff -ur HaRe_20012006_orig/refactorer/PFE0.hs HaRe_20012006/refactorer/PFE0.hs
    old new  
    176176          sendMsg dialog msg = lift (sendEditorMsg editorCmds dialog msg) 
    177177          sendModified f = lift (sendEditorModified editorCmds f) 
    178178      l <- catchEnv getCmd (const $ return "stop") 
    179       let cmdArgs@(cmd: ~(mod:_)) = words l 
     179      let cmdArgs@(cmd: _) = case words l of ws | null ws -> ["empty"]; ws -> ws 
    180180      sendMsg False $ "CMD:"++show cmdArgs 
    181181      unless (cmd=="stop") $ do 
    182182        if (cmd=="undo") then (undoLatestInHistory >> loop prg args)  
  • refactorer/RefacUnGuard.hs

    diff -ur HaRe_20012006_orig/refactorer/RefacUnGuard.hs HaRe_20012006/refactorer/RefacUnGuard.hs
    old new  
    191191-- | Applies the transformation to a given declaration, using the auxiliary functions 
    192192--  defined bellow 
    193193replaceGuards d@(Dec (HsFunBind loc matches)) (_,_,mod) 
    194     = do let newMs1 = findConsist matches --:: [(Bool,Match)] 
     194    = do let newMs1 = findConsist matches -- :: [(Bool,Match)] 
    195195             initSt = getInitSt [m | (b,m) <- newMs1, b] 
    196196             newMs2 = map declsToLet' newMs1 
    197197             newMs3 = dmerge newMs2 initSt 
  • refactorer/RefacUtils.hs

    diff -ur HaRe_20012006_orig/refactorer/RefacUtils.hs HaRe_20012006/refactorer/RefacUtils.hs
    old new  
    5050    ,findPNT,findPN      -- Try to remove this. 
    5151    ,findPNs, findEntity 
    5252    ,sameOccurrence    
    53     ,defines,definesTypeSig, isTypeSigOf,  
     53    ,defines,definesTypeSig, isTypeSigOf 
    5454    ,HasModName(hasModName), HasNameSpace(hasNameSpace)   
    5555    
    5656     
     
    6464 -- * Program transformation  
    6565    -- ** Adding 
    6666    ,addDecl ,addItemsToImport, addHiding, rmItemsFromImport, addItemsToExport 
    67     ,addParamsToDecls, addGuardsToRhs, addImportDecl, duplicateDecl, moveDecl, 
     67    ,addParamsToDecls, addGuardsToRhs, addImportDecl, duplicateDecl, moveDecl 
    6868    -- ** Rmoving 
    69     ,rmDecl, rmTypeSig, commentOutTypeSig, rmParams, 
     69    ,rmDecl, rmTypeSig, commentOutTypeSig, rmParams 
    7070    ,rmItemsFromExport, rmSubEntsFromExport, Delete(delete) 
    7171    -- ** Updating 
    72     ,Update(update), 
     72    ,Update(update) 
    7373    ,qualifyPName,rmQualifier,renamePN,replaceNameInPN,autoRenameLocalVar 
    7474 
    7575-- * Miscellous 
     
    8989   ,mkNewName, applyRefac, applyRefacToClientMods 
    9090                    
    9191    -- The following functions are not in the the API yet. 
    92     ,getDeclToks, causeNameClashInExports, inRegion , ghead, glast, gfromJust, unmodified, prettyprint, 
    93     getDeclAndToks 
     92    ,getDeclToks, causeNameClashInExports, inRegion , ghead, glast, gfromJust, unmodified, prettyprint 
     93    ,getDeclAndToks 
    9494 ) 
    9595where 
    9696import Prelude hiding (putStr,putStrLn,writeFile,readFile) 
  • refactorer/myghc--make

    diff -ur HaRe_20012006_orig/refactorer/myghc--make HaRe_20012006/refactorer/myghc--make
    old new  
    77 
    88case `uname` in 
    99  CYGWIN*) 
    10     ghc --make $GHCFLAGS -cpp -ffi -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -fno-monomorphism-restriction -package lang -package network -i${SRC_DIRS} -odir odir/$SYSTEM -hidir hidir/$SYSTEM -osuf o -hisuf hi $* 
     10    ghc --make $GHCFLAGS -cpp -ffi -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -fno-monomorphism-restriction -i${SRC_DIRS} -odir odir/$SYSTEM -hidir hidir/$SYSTEM -osuf o -hisuf hi $* 
    1111    ;; 
    1212  SunOS*) 
    13     ghc --make $GHCFLAGS -cpp -ffi -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -fno-monomorphism-restriction -package lang -package network -i${SRC_DIRS} -odir odir/$SYSTEM -hidir hidir/$SYSTEM -osuf o -hisuf hi $* 
     13    ghc --make $GHCFLAGS -cpp -ffi -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -fno-monomorphism-restriction -i${SRC_DIRS} -odir odir/$SYSTEM -hidir hidir/$SYSTEM -osuf o -hisuf hi $* 
    1414    ;; 
    1515  *) 
    1616    # default case for unixish systems, confirmed for Mac OS X (10.2.6), Linux (Redhat, Mandrake) 
    17     ghc --make $GHCFLAGS -cpp -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -fno-monomorphism-restriction -package lang -package network -i${SRC_DIRS} -odir odir/$SYSTEM -hidir hidir/$SYSTEM -osuf o -hisuf hi $* 
     17    ghc --make $GHCFLAGS -cpp -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -fno-monomorphism-restriction -i${SRC_DIRS} -odir odir/$SYSTEM -hidir hidir/$SYSTEM -osuf o -hisuf hi $* 
    1818    ;; 
    1919esac 
    2020 
  • tools/base/Modules/Relations.lhs

    diff -ur HaRe_20012006_orig/tools/base/Modules/Relations.lhs HaRe_20012006/tools/base/Modules/Relations.lhs
    old new  
    11>module Relations where 
    22 
    3 >#if __GLASGOW_HASKELL__ >= 604  
     3#if __GLASGOW_HASKELL__ >= 604  
    44>import qualified Data.Map as M 
    55>import qualified Data.Set as S 
    66 
     
    1818>   add fmap (key,elt) = M.insertWith combiner key elt fmap 
    1919 
    2020>findWithDefault a k fm = M.findWithDefault a k fm 
    21 >#else 
     21#else 
    2222>import qualified Data.FiniteMap as M 
    2323>import qualified Sets as S 
    2424 
     
    3232>difference = S.minusSet 
    3333>addListTo_C combiner fm key_elt_pairs = M.addListToFM_C combiner fm key_elt_pairs 
    3434>findWithDefault a k fm = M.lookupWithDefaultFM fm  a k 
    35 >#endif  
     35#endif  
    3636 
    3737 
    3838Relations 
  • tools/base/TI/OrigTiMonad.hs

    diff -ur HaRe_20012006_orig/tools/base/TI/OrigTiMonad.hs HaRe_20012006/tools/base/TI/OrigTiMonad.hs
    old new  
    1010   (>:),freshInt 
    1111  ) where 
    1212import Prelude hiding (lookup) -- for Hugs 
    13 import Monad(MonadPlus(..)) 
     13--import Monad(MonadPlus(..)) 
     14import Control.Monad 
     15import Control.Monad.Error () -- instance for Either String 
    1416import HsIdent(HsIdentI) 
    1517import HsName(ModuleName,Id,noModule) 
    1618import TiTypes 
  • tools/base/defs/UniqueNames.hs

    diff -ur HaRe_20012006_orig/tools/base/defs/UniqueNames.hs HaRe_20012006/tools/base/defs/UniqueNames.hs
    old new  
    7676  ppiOp (PN i n) = ppiOp i<>n 
    7777 
    7878instance Printable Orig where 
    79   ppi (D n (N s)) = ppi (subnum n)<+>ppIfDebug ("«"<>s<>"»") 
    80   ppi (S p) = ppIfDebug ("«"<>p<>"»") 
    81   ppi (G m _ _) = ppIfDebug ("«"<>m<>"»") 
    82   --ppi (Sn n (SrcLoc f r c)) = "«"<>r<>","<>c<>"»" 
     79  ppi (D n (N s)) = ppi (subnum n)<+>ppIfDebug ("<<"<>s<>">>") 
     80  ppi (S p) = ppIfDebug ("<<"<>p<>">>") 
     81  ppi (G m _ _) = ppIfDebug ("<<"<>m<>">>") 
     82  --ppi (Sn n (SrcLoc f r c)) = "<<"<>r<>","<>c<>">>" 
    8383  ppi _ = empty 
    8484 
    8585subnum n = ppIfUnicode (subdigs (show n)) n 
  • tools/base/parse2/SourceNames.hs

    diff -ur HaRe_20012006_orig/tools/base/parse2/SourceNames.hs HaRe_20012006/tools/base/parse2/SourceNames.hs
    old new  
    5757--- 
    5858 
    5959instance Printable   i => Printable   (SN i) where 
    60   ppi (SN n p) = ppi n<>ppIfDebug ("«"<>p<>"»") 
    61   wrap (SN n p) = wrap n<>ppIfDebug ("«"<>p<>"»") 
     60  ppi (SN n p) = ppi n<>ppIfDebug ("<<"<>p<>">>") 
     61  wrap (SN n p) = wrap n<>ppIfDebug ("<<"<>p<>">>") 
    6262 
    6363            -- positions ends up outside parenthesis... 
    6464 
    6565instance PrintableOp i => PrintableOp (SN i) where 
    6666  isOp (SN n p) = isOp n 
    67   ppiOp (SN n p) = ppiOp n<>ppIfDebug ("«"<>p<>"»") 
     67  ppiOp (SN n p) = ppiOp n<>ppIfDebug ("<<"<>p<>">>") 
    6868 
    6969 
    7070hsName2modName (SN hs loc) =