@@ -533,6 +533,7 @@ data PTerm = PQuote Raw
533533 | PLet Name PTerm PTerm PTerm
534534 | PTyped PTerm PTerm -- ^ Term with explicit type
535535 | PApp FC PTerm [PArg]
536+ | PAppBind FC PTerm [PArg] -- ^ implicitly bound application
536537 | PMatchApp FC Name -- ^ Make an application by type matching
537538 | PCase FC PTerm [(PTerm, PTerm)]
538539 | PTrue FC
@@ -573,6 +574,7 @@ mapPT f t = f (mpt t) where
573574 mpt (PRewrite fc t s g) = PRewrite fc (mapPT f t) (mapPT f s)
574575 (fmap (mapPT f) g)
575576 mpt (PApp fc t as) = PApp fc (mapPT f t) (map (fmap (mapPT f)) as)
577+ mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as)
576578 mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os)
577579 mpt (PEq fc l r) = PEq fc (mapPT f l) (mapPT f r)
578580 mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r)
@@ -957,6 +959,8 @@ prettyImp impl = prettySe 10
957959 rbrace <+> text "->" <+> prettySe 10 sc
958960 prettySe p (PApp _ (PRef _ f) [])
959961 | not impl = pretty f
962+ prettySe p (PAppBind _ (PRef _ f) [])
963+ | not impl = pretty f <+> text "!"
960964 prettySe p (PApp _ (PRef _ op@(UN (f:_))) args)
961965 | length (getExps args) == 2 && (not impl) && (not $ isAlpha f) =
962966 let [l, r] = getExps args in
@@ -1142,6 +1146,8 @@ showImp ist impl colour tm = se 10 [] tm where
11421146 se p bnd (PMatchApp _ f) = "match " ++ show f
11431147 se p bnd (PApp _ hd@(PRef _ f) [])
11441148 | not impl = se p bnd hd
1149+ se p bnd (PAppBind _ hd@(PRef _ f) [])
1150+ | not impl = se p bnd hd ++ "!"
11451151 se p bnd (PApp _ op@(PRef _ (UN (f:_))) args)
11461152 | length (getExps args) == 2 && not impl && not (isAlpha f)
11471153 = let [l, r] = getExps args in
@@ -1150,6 +1156,10 @@ showImp ist impl colour tm = se 10 [] tm where
11501156 = let args = getExps as in
11511157 bracket p 1 $ se 1 bnd f ++ if impl then concatMap (sArg bnd) as
11521158 else concatMap (seArg bnd) args
1159+ se p bnd (PAppBind _ f as)
1160+ = let args = getExps as in
1161+ bracket p 1 $ se 1 bnd f ++ "!" ++ if impl then concatMap (sArg bnd) as
1162+ else concatMap (seArg bnd) args
11531163 se p bnd (PCase _ scr opts) = "case " ++ se 10 bnd scr ++ " of " ++ showSep " | " (map sc opts)
11541164 where sc (l, r) = se 10 bnd l ++ " => " ++ se 10 bnd r
11551165 se p bnd (PHidden tm) = "." ++ se 0 bnd tm
@@ -1238,6 +1248,7 @@ instance Sized PTerm where
12381248 size (PLet name ty def bdy) = 1 + size ty + size def + size bdy
12391249 size (PTyped trm ty) = 1 + size trm + size ty
12401250 size (PApp fc name args) = 1 + size args
1251+ size (PAppBind fc name args) = 1 + size args
12411252 size (PCase fc trm bdy) = 1 + size trm + size bdy
12421253 size (PTrue fc) = 1
12431254 size (PFalse fc) = 1
@@ -1274,6 +1285,7 @@ allNamesIn tm = nub $ ni [] tm
12741285 ni env (PRef _ n)
12751286 | not (n `elem` env) = [n]
12761287 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1288+ ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
12771289 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
12781290 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
12791291 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
@@ -1300,6 +1312,7 @@ namesIn uvars ist tm = nub $ ni [] tm
13001312 [] -> [n]
13011313 _ -> if n `elem` (map fst uvars) then [n] else []
13021314 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1315+ ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
13031316 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
13041317 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
13051318 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc
@@ -1326,6 +1339,7 @@ usedNamesIn vars ist tm = nub $ ni [] tm
13261339 [] -> [n]
13271340 _ -> []
13281341 ni env (PApp _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
1342+ ni env (PAppBind _ f as) = ni env f ++ concatMap (ni env) (map getTm as)
13291343 ni env (PCase _ c os) = ni env c ++ concatMap (ni env) (map snd os)
13301344 ni env (PLam n ty sc) = ni env ty ++ ni (n:env) sc
13311345 ni env (PPi _ n ty sc) = ni env ty ++ ni (n:env) sc