Skip to content

Commit

Permalink
add strengthen{1,2} as suggested in #8
Browse files Browse the repository at this point in the history
  • Loading branch information
ekmett committed Jul 28, 2016
1 parent 30f1e92 commit 23b4404
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Data/Constraint.hs
Expand Up @@ -63,6 +63,7 @@ module Data.Constraint
, (:-)(Sub)
, (\\)
, weaken1, weaken2, contract
, strengthen1, strengthen2
, (&&&), (***)
, trans, refl
, Bottom
Expand Down Expand Up @@ -292,6 +293,12 @@ weaken1 = Sub Dict
weaken2 :: (a, b) :- b
weaken2 = Sub Dict

strengthen1 :: Dict b -> a :- c -> a :- (b,c)
strengthen1 d e = unmapDict (const d) &&& e

strengthen2 :: Dict b -> a :- c -> a :- (c,b)
strengthen2 d e = e &&& unmapDict (const d)

-- | Contracting a constraint / diagonal morphism
--
-- The category of constraints is Cartesian. We can reuse information.
Expand Down

0 comments on commit 23b4404

Please sign in to comment.