-- returns the FieldInfos to be updated to use the fully-qualified, globally defined types
-- instead of defining the same types all over locally.
uni :: [V.Vector FieldInfo] -> V.Vector FieldInfo
uni dups = V.fromList $ go dups []
    where
        go [] acc = acc
        go (ds:dss) acc =
            let cur = V.head ds
            in if V.all (\fi -> type_ fi == type_ cur) ds
                then go dss $ cur:acc
                else go dss acc

-- returns all duplicate FieldInfos
uni :: [V.Vector FieldInfo] -> V.Vector FieldInfo
uni dups = V.fromList $ go dups []
    where
        go [] acc = acc
        go (ds:dss) acc =
            let cur = V.head ds
            in if V.all (\fi -> type_ fi == type_ cur) ds
                then go dss $ cur:acc
                else go dss acc

-- returns all duplicate FieldInfos
uni dups = V.fromList $ go dups []
    where
        go [] acc = acc
        go (ds:dss) acc =
            let cur = V.head ds
            in if V.all (\fi -> type_ fi == type_ cur) ds
                then go dss $ cur:acc
                else go dss acc

-- returns all duplicate FieldInfos