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..]
 | 
					numbered = zip [1..]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dayToJsTimestamp :: Day -> Integer
 | 
					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)
 | 
					                     where t = UTCTime d (secondsToDiffTime 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chomp :: String -> String
 | 
					chomp :: String -> String
 | 
				
			||||||
 | 
				
			|||||||
@ -103,12 +103,13 @@ fileModificationTime :: FilePath -> IO ClockTime
 | 
				
			|||||||
fileModificationTime f
 | 
					fileModificationTime f
 | 
				
			||||||
    | null f = getClockTime
 | 
					    | null f = getClockTime
 | 
				
			||||||
    | otherwise = (do
 | 
					    | otherwise = (do
 | 
				
			||||||
 | 
					-- getModificationTime returned a ClockTime till GHC 7.6 (directory 1.2), now it's UTCTime
 | 
				
			||||||
#if __GLASGOW_HASKELL__ < 706
 | 
					#if __GLASGOW_HASKELL__ < 706
 | 
				
			||||||
        clo <- getModificationTime f
 | 
					        clo <- getModificationTime f
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
        utc <- getModificationTime f
 | 
					        utc <- getModificationTime f
 | 
				
			||||||
        let nom = utcTimeToPOSIXSeconds utc
 | 
					        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
 | 
					#endif
 | 
				
			||||||
        return clo
 | 
					        return clo
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user