Commit e2ff6acf authored by Vincent Zweije's avatar Vincent Zweije
Browse files

Make Pfun comparable using ==

parent 3c139e9c
...@@ -45,3 +45,5 @@ instance toString Pfun dom ran | toString dom & toString ran ...@@ -45,3 +45,5 @@ instance toString Pfun dom ran | toString dom & toString ran
on the nodes in `dom' for which it is defined. on the nodes in `dom' for which it is defined.
*/ */
idpfun :: !.[dom] .(Pfun dom dom) -> Bool | == dom idpfun :: !.[dom] .(Pfun dom dom) -> Bool | == dom
instance == (Pfun dom ran) | == dom & == ran
...@@ -82,3 +82,11 @@ idpfun :: !.[dom] .(Pfun dom dom) -> Bool | == dom ...@@ -82,3 +82,11 @@ idpfun :: !.[dom] .(Pfun dom dom) -> Bool | == dom
idpfun domain pfun idpfun domain pfun
= all idelem domain = all idelem domain
where idelem x = total True (postcomp ((==) x) pfun) x where idelem x = total True (postcomp ((==) x) pfun) x
instance == (Pfun dom ran) | == dom & == ran
where (==) EmptyPfun EmptyPfun = True
(==) (Extend x1 y1 pf1) (Extend x2 y2 pf2)
= x1==x2 && y1==y2 && pf1==pf2
(==) (Restrict x1 pf1) (Restrict x2 pf2)
= x1==x2 && pf1==pf2
(==) _ _ = False
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment