Verified Commit 705b5d7a authored by Camil Staps's avatar Camil Staps
Browse files

Resolve clean-cloogle/cloogle.org#157: no duplicate instances when type...

Resolve clean-cloogle/cloogle.org#157: no duplicate instances when type variables are named differently
parent 2801f19d
Subproject commit 2849b36c004123d02195c26147d56ca7b5550df8
Subproject commit 88f9081be752059680def72dee18646f0a58af7f
......@@ -14,6 +14,7 @@ import StdTuple
import Control.Applicative
import Control.Monad
import Data.Bifunctor
import Data.Error
from Data.Func import $
import Data.Functor
......@@ -272,8 +273,9 @@ where
update :: [InstanceEntry] -> [InstanceEntry]
update [] = [{ie_types=t,ie_locations=[l]}]
update [ie:rest]
| ie.ie_types == t = [{ie & ie_locations=removeDup [l:ie.ie_locations]}:rest]
| otherwise = [ie:update rest]
| identical = [{ie & ie_locations=removeDup [l:ie.ie_locations]}:rest]
| otherwise = [ie:update rest]
where identical = all (uncurry (isomorphic_to)) $ map (bifmap fst fst) $ zip2 ie.ie_types t
putInstances :: ![(!Name, ![(!Type,!String)], !Location)] !CloogleDB -> CloogleDB
putInstances is db = foldr (\(c,ts,l) -> putInstance c ts l) db is
......
Markdown is supported
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