You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
merge is trivially a Setter. The current signature of merge
merge :: (IsMergeable a b c) => a -> b -> c can be changed to
merge :: (IsMergeable a b c) => Setter a c a b.
If this seems too much of a change, we can export a new setter mergeS that is defined in terms of the existing merge function as
-- This is a Setter with an additional IsMergeable constraintmergeS:: (IsMergeableabc, Settablef) => (a->fb) ->a->fc
mergeS = sets (\f s -> merge (f s) s)
Additionally, the order in which we merge shouldn't matter. So changing the class definition slightly as
class (IsMergeablebac) => (IsMergeableabc) |ab->cwheremerge::a->b->c
merge a b = merge b a -- flip merge
Example:
tn::TagNewStringValidatedtnd::TagNewDeltaValidatedt::TagStringValidated
tn & mergeS .~ tnd == tnd & mergeS .~ tn == t -- Tag String Validated
These should be simple fixes and can be incorporated into the library pretty easily.
Possible Future Improvements:
This also seems to indicate that the HasSplice class and IsMergeable class can be mixed into one. In a future improvement it can probably be developed in such a way as to say HasSplice c a b means c can be decomposed into a and b, and a and b can be merged to form a c, but this seems too much like sub typing in Java .
The text was updated successfully, but these errors were encountered:
merge
is trivially a Setter. The current signature of mergemerge :: (IsMergeable a b c) => a -> b -> c
can be changed tomerge :: (IsMergeable a b c) => Setter a c a b
.If this seems too much of a change, we can export a new setter
mergeS
that is defined in terms of the existingmerge
function asAdditionally, the order in which we merge shouldn't matter. So changing the class definition slightly as
Example:
These should be simple fixes and can be incorporated into the library pretty easily.
Possible Future Improvements:
This also seems to indicate that the
HasSplice
class andIsMergeable
class can be mixed into one. In a future improvement it can probably be developed in such a way as to sayHasSplice c a b
meansc
can be decomposed intoa
andb
, anda
andb
can be merged to form ac
, but this seems too much like sub typing in Java .The text was updated successfully, but these errors were encountered: