lib: Make Default instances clearer, remove Default instance for Bool.
This commit is contained in:
		
							parent
							
								
									ff0c5bc743
								
							
						
					
					
						commit
						2aaab4b1b7
					
				| @ -199,7 +199,17 @@ data InputOpts = InputOpts { | |||||||
| instance Default InputOpts where def = definputopts | instance Default InputOpts where def = definputopts | ||||||
| 
 | 
 | ||||||
| definputopts :: InputOpts | definputopts :: InputOpts | ||||||
| definputopts = InputOpts def def def def def def True def def | definputopts = InputOpts | ||||||
|  |     { mformat_           = Nothing | ||||||
|  |     , mrules_file_       = Nothing | ||||||
|  |     , aliases_           = [] | ||||||
|  |     , anon_              = False | ||||||
|  |     , ignore_assertions_ = False | ||||||
|  |     , new_               = False | ||||||
|  |     , new_save_          = True | ||||||
|  |     , pivot_             = "" | ||||||
|  |     , auto_              = False | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| rawOptsToInputOpts :: RawOpts -> InputOpts | rawOptsToInputOpts :: RawOpts -> InputOpts | ||||||
| rawOptsToInputOpts rawopts = InputOpts{ | rawOptsToInputOpts rawopts = InputOpts{ | ||||||
|  | |||||||
| @ -36,7 +36,6 @@ where | |||||||
| 
 | 
 | ||||||
| import Control.Monad (liftM, when) | import Control.Monad (liftM, when) | ||||||
| -- import Data.Char | -- import Data.Char | ||||||
| import Data.Default |  | ||||||
| import Data.FileEmbed (makeRelativeToProject, embedStringFile) | import Data.FileEmbed (makeRelativeToProject, embedStringFile) | ||||||
| import Data.List | import Data.List | ||||||
| -- import Data.Maybe | -- import Data.Maybe | ||||||
| @ -144,8 +143,6 @@ getCurrentZonedTime = do | |||||||
| 
 | 
 | ||||||
| -- misc | -- misc | ||||||
| 
 | 
 | ||||||
| instance Default Bool where def = False |  | ||||||
| 
 |  | ||||||
| -- | Apply a function the specified number of times, | -- | Apply a function the specified number of times, | ||||||
| -- which should be > 0 (otherwise does nothing). | -- which should be > 0 (otherwise does nothing). | ||||||
| -- Possibly uses O(n) stack ? | -- Possibly uses O(n) stack ? | ||||||
|  | |||||||
| @ -415,17 +415,18 @@ instance Default CliOpts where def = defcliopts | |||||||
| 
 | 
 | ||||||
| defcliopts :: CliOpts | defcliopts :: CliOpts | ||||||
| defcliopts = CliOpts | defcliopts = CliOpts | ||||||
|     def |     { rawopts_         = def | ||||||
|     def |     , command_         = "" | ||||||
|     def |     , file_            = [] | ||||||
|     def |     , inputopts_       = def | ||||||
|     def |     , reportopts_      = def | ||||||
|     def |     , output_file_     = Nothing | ||||||
|     def |     , output_format_   = Nothing | ||||||
|     def |     , debug_           = 0 | ||||||
|     def |     , no_new_accounts_ = False | ||||||
|     def |     , width_           = Nothing | ||||||
|     defaultWidth |     , available_width_ = defaultWidth | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
| -- | Default width for hledger console output, when not otherwise specified. | -- | Default width for hledger console output, when not otherwise specified. | ||||||
| defaultWidth :: Int | defaultWidth :: Int | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user