I have an entry in a document that uses two IntMaps:
data Doc = Doc { kernels :: IntMap Kernel, nodes :: IntMap Node }
But I found that the keys to both IntMaps have different meanings, and I cannot separate them in two different types and I get no errors when using socket kernel types and node types. I want to have functions that check the keys of the kernel map and the node map and do not allow confusion. For instance:
someFunction :: Doc -> KernelKey -> NodeKey -> a
someFunction doc k1 k2 = .....
Instead of current:
someFunction :: Doc -> Int -> Int -> a
someFunction doc k1 k2 = .... -- warning check twice k1 and k2
Is it possible? Or I will change from IntMapto Map.
thank
source
share