@@ -142,6 +142,14 @@ genAll i args
142 otherPats :: PTerm -> [PTerm]
142 otherPats :: PTerm -> [PTerm]
143 otherPats o@(PRef fc n) = ops fc n [] o
143 otherPats o@(PRef fc n) = ops fc n [] o
144 otherPats o@(PApp _ (PRef fc n) xs) = ops fc n xs o
144 otherPats o@(PApp _ (PRef fc n) xs) = ops fc n xs o
145+ otherPats o@(PPair fc l r)
147+ ([pimp (UN "A") Placeholder, pimp (UN "B") Placeholder] ++
149+ otherPats o@(PDPair fc t _ v)
150+ = ops fc (UN "Ex_intro")
151+ ([pimp (UN "a") Placeholder, pimp (UN "P") Placeholder] ++
145 otherPats arg = return Placeholder
153 otherPats arg = return Placeholder
147 ops fc n xs_in o
155 ops fc n xs_in o
@@ -149,13 +157,21 @@ genAll i args
149 = do let force = getForceable i n -- no need to generate forceable positions
157 = do let force = getForceable i n -- no need to generate forceable positions
150 let xs = dropForce force xs_in 0
158 let xs = dropForce force xs_in 0
151 xs' <- mapM otherPats (map getTm xs)
159 xs' <- mapM otherPats (map getTm xs)
152− let p = PApp fc (PRef fc n) (zipWith upd xs' xs)
160+ let p = resugar (PApp fc (PRef fc n) (zipWith upd xs' xs))
153 let tyn = getTy n (tt_ctxt i)
161 let tyn = getTy n (tt_ctxt i)
154 case lookupCtxt tyn (idris_datatypes i) of
162 case lookupCtxt tyn (idris_datatypes i) of
155 (TI ns _ _ : _) -> p : map (mkPat fc) (ns \\ [n])
163 (TI ns _ _ : _) -> p : map (mkPat fc) (ns \\ [n])
157 ops fc n arg o = return Placeholder
165 ops fc n arg o = return Placeholder
167+ -- put it back to its original form
168+ resugar (PApp _ (PRef fc (UN "Ex_intro")) [_,_,t,v])
169+ = PDPair fc (getTm t) Placeholder (getTm v)
170+ resugar (PApp _ (PRef fc n) [_,_,l,r])
172+ = PPair fc (getTm l) (getTm r)
159 getForceable i n = case lookupCtxt n (idris_optimisation i) of
175 getForceable i n = case lookupCtxt n (idris_optimisation i) of
160 [Optimise _ fs _] -> fs
176 [Optimise _ fs _] -> fs