[Type-constraints] Do not duplicate constraints

This commit is contained in:
Nikolay Yakimov 2016-01-20 03:11:50 +03:00
parent 8449d36eca
commit bca7748264
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import Outputable (PprStyle)
import TcHsSyn (hsPatType)
import Prelude
import Control.Monad
import Data.List (nub)
import Control.Arrow
import qualified Data.Map as M
@ -72,7 +73,7 @@ collectSpansTypes withConstraints tcs lc =
| otherwise = (maybeToList <$> getType' x, s)
constrainedType pids s spn genTyp =
let
ctys = mapMaybe build pids
ctys = mapMaybe build (nub pids)
build x | Just cti <- x `M.lookup` s
= let
(preds', ctt) = getPreds cti