on master help sign in
Merge pull request #1470 from edwinb/master

Fix parameter identification

commit42dbdbe0083443af8d73f648a9d9754ddd0c8163 authorEdwin Brady <edwin.brady@gmail.com> dateTue 12 Aug 2014, 10:26 (12 years ago) parent4c17201a523c20
1 file changed+9−2
src/Idris/Elab/Data.hs+9−2
src/Idris/Elab/Data.hs+9−2
@@ -132,8 +132,15 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
132132 -- them for repeated arguments
133133
134134 findParams :: [Type] -> [Int]
135− findParams ts = let allapps = concatMap getDataApp ts in
136− paramPos allapps
135+ findParams ts = let allapps = map getDataApp ts
136+ -- do each constructor separately, then merge the results (names
137+ -- may change between constructors)
138+ conParams = map paramPos allapps in
139+ inAll conParams
140+
141+ inAll :: [[Int]] -> [Int]
142+ inAll [] = []
143+ inAll (x : xs) = filter (\p -> all (\ps -> p `elem` ps) xs) x
137144
138145 paramPos [] = []
139146 paramPos (args : rest)