lib: Make Default instances clearer, remove Default instance for Bool.

This commit is contained in:
Stephen Morgan 2020-09-11 16:51:56 +10:00 committed by Simon Michael
parent ff0c5bc743
commit 2aaab4b1b7
3 changed files with 23 additions and 15 deletions

View File

@ -199,7 +199,17 @@ data InputOpts = InputOpts {
instance Default InputOpts where def = definputopts
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{

View File

@ -36,7 +36,6 @@ where
import Control.Monad (liftM, when)
-- import Data.Char
import Data.Default
import Data.FileEmbed (makeRelativeToProject, embedStringFile)
import Data.List
-- import Data.Maybe
@ -144,8 +143,6 @@ getCurrentZonedTime = do
-- misc
instance Default Bool where def = False
-- | Apply a function the specified number of times,
-- which should be > 0 (otherwise does nothing).
-- Possibly uses O(n) stack ?

View File

@ -415,17 +415,18 @@ instance Default CliOpts where def = defcliopts
defcliopts :: CliOpts
defcliopts = CliOpts
def
def
def
def
def
def
def
def
def
def
defaultWidth
{ rawopts_ = def
, command_ = ""
, file_ = []
, inputopts_ = def
, reportopts_ = def
, output_file_ = Nothing
, output_format_ = Nothing
, debug_ = 0
, no_new_accounts_ = False
, width_ = Nothing
, available_width_ = defaultWidth
}
-- | Default width for hledger console output, when not otherwise specified.
defaultWidth :: Int