darcs

Issue 1604 refactor and clean up in src/Darcs/Patch/Depends.hs

Title refactor and clean up in src/Darcs/Patch/Depends.hs
Priority feature Status given-up
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, ganesh
Assigned To ganesh
Topics Library

Created on 2009-09-09.19:38:47 by dagit, last changed 2022-04-12.15:03:24 by bfrk.

Messages
msg8778 (view) Author: dagit Date: 2009-09-09.19:38:39
The module src/Darcs/Patch/Depends.hs is central to darcs patch theory in that
we use it with most operations to get the common and uncommon patches between
repositories.

Several bugs have manifested as impossible and bug cases in code in the Depends
module.  Inspecting the code it would appear the algorithms are expressed in an
unsafe way, as evidenced by the many uses of unsafeCoerceP.

The function get_common_and_uncommon appears to always add (:<:NilRL) to the
sequences it returns.  This then typically requires the caller to remove the
NilRL before processing the output.  This results in "impossible" cases in the
calling code.  These impossible cases will be triggered if the contract of
get_common_and_uncommon is ever changed.  For this reason, we should simplify
the type of get_common_and_uncommon and remove the extra (:<:NilRL) on the ends
of the output.

get_extra is another important function in Depends that deserves to be cleaned up.

Overall, we should consider reorganizing and restructuring the code in this
module so that a) each function has unit tests b) each function has decent
description in haddocks c) re-expressing the algorithms so that the
unsafeCoercePs are no longer needed.  This code is very important and so changes
here must be carefully review and tested.  Perhaps we could even set code
coverage goals for this module given the importance.
msg22974 (view) Author: bfrk Date: 2022-04-12.15:03:23
The file in question has changed a lot in recent years so this seems 
no longer relevant.
History
Date User Action Args
2009-09-09 19:38:47dagitcreate
2009-09-09 20:09:18koweysetpriority: feature
status: needs-reproduction -> has-patch
assignedto: ganesh
nosy: + ganesh
2009-09-29 06:49:12dagitsetnosy: - dagit
2010-04-03 12:07:37koweysettopic: + Library
2022-04-12 15:03:24bfrksetstatus: has-patch -> given-up
messages: + msg22974