web: quick fix for "Prelude.read: no parse" errors with GHC >= 7.6
This commit is contained in:
		
							parent
							
								
									81354fb492
								
							
						
					
					
						commit
						26a37bf3df
					
				@ -122,7 +122,7 @@ numbered :: [a] -> [(Int,a)]
 | 
			
		||||
numbered = zip [1..]
 | 
			
		||||
 | 
			
		||||
dayToJsTimestamp :: Day -> Integer
 | 
			
		||||
dayToJsTimestamp d = read (formatTime defaultTimeLocale "%s" t) * 1000
 | 
			
		||||
dayToJsTimestamp d = read (formatTime defaultTimeLocale "%s" t) * 1000 -- XXX read
 | 
			
		||||
                     where t = UTCTime d (secondsToDiffTime 0)
 | 
			
		||||
 | 
			
		||||
chomp :: String -> String
 | 
			
		||||
 | 
			
		||||
@ -103,12 +103,13 @@ fileModificationTime :: FilePath -> IO ClockTime
 | 
			
		||||
fileModificationTime f
 | 
			
		||||
    | null f = getClockTime
 | 
			
		||||
    | otherwise = (do
 | 
			
		||||
-- getModificationTime returned a ClockTime till GHC 7.6 (directory 1.2), now it's UTCTime
 | 
			
		||||
#if __GLASGOW_HASKELL__ < 706
 | 
			
		||||
        clo <- getModificationTime f
 | 
			
		||||
#else
 | 
			
		||||
        utc <- getModificationTime f
 | 
			
		||||
        let nom = utcTimeToPOSIXSeconds utc
 | 
			
		||||
        let clo = TOD (read $ show nom) 0 -- XXX
 | 
			
		||||
        let clo = TOD (read $ takeWhile (`elem` "0123456789") $ show nom) 0 -- XXX read
 | 
			
		||||
#endif
 | 
			
		||||
        return clo
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user