cleanup
This commit is contained in:
		
							parent
							
								
									0df6998b58
								
							
						
					
					
						commit
						dae007a372
					
				@ -362,16 +362,14 @@ getDefaultCommodityAndStyle = jparsedefaultcommodity `fmap` get
 | 
				
			|||||||
getDefaultAmountStyle :: JournalParser m (Maybe AmountStyle)
 | 
					getDefaultAmountStyle :: JournalParser m (Maybe AmountStyle)
 | 
				
			||||||
getDefaultAmountStyle = fmap snd <$> getDefaultCommodityAndStyle
 | 
					getDefaultAmountStyle = fmap snd <$> getDefaultCommodityAndStyle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | Lookup currency-specific amount style.
 | 
					-- | Get the 'AmountStyle' declared by the most recently parsed (in the current or parent files,
 | 
				
			||||||
--
 | 
					-- prior to the current position) commodity directive for the given commodity, if any.
 | 
				
			||||||
-- Returns 'AmountStyle' used in commodity directive within current journal
 | 
					 | 
				
			||||||
-- prior to current position or in its parents files.
 | 
					 | 
				
			||||||
getAmountStyle :: CommoditySymbol -> JournalParser m (Maybe AmountStyle)
 | 
					getAmountStyle :: CommoditySymbol -> JournalParser m (Maybe AmountStyle)
 | 
				
			||||||
getAmountStyle commodity = do
 | 
					getAmountStyle commodity = do
 | 
				
			||||||
    specificStyle <-  maybe Nothing cformat . M.lookup commodity . jcommodities <$> get
 | 
					  Journal{jcommodities} <- get
 | 
				
			||||||
    defaultStyle <- fmap snd <$> getDefaultCommodityAndStyle
 | 
					  let mspecificStyle = M.lookup commodity jcommodities >>= cformat
 | 
				
			||||||
    let effectiveStyle = listToMaybe $ catMaybes [specificStyle, defaultStyle]
 | 
					  mdefaultStyle <- fmap snd <$> getDefaultCommodityAndStyle
 | 
				
			||||||
    return effectiveStyle
 | 
					  return $ listToMaybe $ catMaybes [mspecificStyle, mdefaultStyle]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
addDeclaredAccountType :: AccountName -> AccountType -> JournalParser m ()
 | 
					addDeclaredAccountType :: AccountName -> AccountType -> JournalParser m ()
 | 
				
			||||||
addDeclaredAccountType acct atype =
 | 
					addDeclaredAccountType acct atype =
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user