;check: uniqueleafnames: short circuit to avoid wasted work
This commit is contained in:
		
							parent
							
								
									b96713a584
								
							
						
					
					
						commit
						6931eec3ce
					
				| @ -23,9 +23,11 @@ import Text.Printf (printf) | |||||||
| journalCheckUniqueleafnames :: Journal -> Either String () | journalCheckUniqueleafnames :: Journal -> Either String () | ||||||
| journalCheckUniqueleafnames j = do | journalCheckUniqueleafnames j = do | ||||||
|   -- find all duplicate leafnames, and the full account names they appear in |   -- find all duplicate leafnames, and the full account names they appear in | ||||||
|   let dupes = finddupes $ journalLeafAndFullAccountNames j |   case finddupes $ journalLeafAndFullAccountNames j of | ||||||
|   -- report the first posting that references one of them (and its position), for now |     [] -> Right () | ||||||
|   sequence_ $ map (checkposting dupes) $ journalPostings j |     dupes ->  | ||||||
|  |       -- report the first posting that references one of them (and its position), for now | ||||||
|  |       sequence_ $ map (checkposting dupes) $ journalPostings j | ||||||
| 
 | 
 | ||||||
| finddupes :: (Ord leaf, Eq full) => [(leaf, full)] -> [(leaf, [full])] | finddupes :: (Ord leaf, Eq full) => [(leaf, full)] -> [(leaf, [full])] | ||||||
| finddupes leafandfullnames = zip dupLeafs dupAccountNames | finddupes leafandfullnames = zip dupLeafs dupAccountNames | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user