lib, web: remove obsolete conditionals for old GHC
This commit is contained in:
		
							parent
							
								
									b324d3de95
								
							
						
					
					
						commit
						f02d35ff39
					
				| @ -10,9 +10,7 @@ | ||||
| module Hledger.Utils.Debug ( | ||||
|   module Hledger.Utils.Debug | ||||
|   ,module Debug.Trace | ||||
| #if __GLASGOW_HASKELL__ >= 704 | ||||
|   ,ppShow | ||||
| #endif | ||||
| ) | ||||
| where | ||||
| 
 | ||||
| @ -28,14 +26,7 @@ import           System.Exit | ||||
| import           System.IO.Unsafe (unsafePerformIO) | ||||
| import           Text.Megaparsec | ||||
| import           Text.Printf | ||||
| 
 | ||||
| #if __GLASGOW_HASKELL__ >= 704 | ||||
| import           Text.Show.Pretty (ppShow) | ||||
| #else | ||||
| -- the required pretty-show version requires GHC >= 7.4 | ||||
| ppShow :: Show a => a -> String | ||||
| ppShow = show | ||||
| #endif | ||||
| 
 | ||||
| pprint :: Show a => a -> IO () | ||||
| pprint = putStrLn . ppShow | ||||
|  | ||||
| @ -44,10 +44,6 @@ where | ||||
| -- import qualified Data.ByteString.Lazy.UTF8 as U8 (toString, fromString) | ||||
| import Prelude hiding (readFile, writeFile, appendFile, getContents, putStr, putStrLn) | ||||
| import System.IO -- (Handle) | ||||
| -- #if __GLASGOW_HASKELL__ < 702 | ||||
| -- import Codec.Binary.UTF8.String as UTF8 (decodeString, encodeString, isUTF8Encoded) | ||||
| -- import System.Info (os) | ||||
| -- #endif | ||||
| 
 | ||||
| -- bom :: B.ByteString | ||||
| -- bom = B.pack [0xEF, 0xBB, 0xBF] | ||||
| @ -100,24 +96,12 @@ type SystemString = String | ||||
| -- | Convert a system string to an ordinary string, decoding from UTF-8 if | ||||
| -- it appears to be UTF8-encoded and GHC version is less than 7.2. | ||||
| fromSystemString :: SystemString -> String | ||||
| -- #if __GLASGOW_HASKELL__ < 702 | ||||
| -- fromSystemString s = if UTF8.isUTF8Encoded s then UTF8.decodeString s else s | ||||
| -- #else | ||||
| fromSystemString = id | ||||
| -- #endif | ||||
| 
 | ||||
| -- | Convert a unicode string to a system string, encoding with UTF-8 if | ||||
| -- we are on a posix platform with GHC < 7.2. | ||||
| toSystemString :: String -> SystemString | ||||
| -- #if __GLASGOW_HASKELL__ < 702 | ||||
| -- toSystemString = case os of | ||||
| --                      "unix" -> UTF8.encodeString | ||||
| --                      "linux" -> UTF8.encodeString | ||||
| --                      "darwin" -> UTF8.encodeString | ||||
| --                      _ -> id | ||||
| -- #else | ||||
| toSystemString = id | ||||
| -- #endif | ||||
| 
 | ||||
| -- | A SystemString-aware version of error. | ||||
| error' :: String -> a | ||||
|  | ||||
| @ -17,17 +17,4 @@ import           Settings             as Import | ||||
| import           Settings.Development as Import | ||||
| import           Settings.StaticFiles as Import | ||||
| 
 | ||||
| #if __GLASGOW_HASKELL__ >= 704 | ||||
| import           Data.Monoid          as Import ( | ||||
| #if !MIN_VERSION_base(4,8,0) | ||||
|                                                  Monoid (mappend, mempty, mconcat), | ||||
| #endif | ||||
|                                                  (<>)) | ||||
| #else | ||||
| import           Data.Monoid          as Import | ||||
|                                                  (Monoid (mappend, mempty, mconcat)) | ||||
| 
 | ||||
| infixr 5 <> | ||||
| (<>) :: Monoid m => m -> m -> m | ||||
| (<>) = mappend | ||||
| #endif | ||||
| import           Data.Monoid          as Import ((<>)) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user