@@ -16,6 +16,7 @@ import Control.Applicative hiding (Const)
16import Control.Monad.State
16import Control.Monad.State
17import Control.Monad
17import Control.Monad
18import Data.List
18import Data.List
19import qualified Data.Traversable as Traversable
20import qualified Data.Traversable as Traversable
21import Debug.Trace
22import Debug.Trace
@@ -211,6 +212,24 @@ getParamsInType i env ps t = let fix = getFixedInType i env ps t
211 flex = getFlexInType i env fix t in
212 flex = getFlexInType i env fix t in
212 [x | x <- fix, not (x `elem` flex)]
213 [x | x <- fix, not (x `elem` flex)]
215+getTCinj i (Bind n (Pi _ t _) sc)
216+ = getTCinj i t ++ getTCinj i (instantiate (P Bound n t) sc)
217+getTCinj i ap@(App _ f a)
218+ | (P _ n _, args) <- unApply ap,
219+ isTCName n = mapMaybe getInjName args
222+ isTCName n = case lookupCtxtExact n (idris_classes i) of
225+ getInjName t | (P _ x _, _) <- unApply t = Just x
226+ | otherwise = Nothing
229+getTCParamsInType :: IState -> [Name] -> [PArg] -> Type -> [Name]
230+getTCParamsInType i env ps t = let params = getParamsInType i env ps t
231+ tcs = nub $ getTCinj i t in
232+ filter (flip elem tcs) params
214paramNames args env [] = []
233paramNames args env [] = []
215paramNames args env (p : ps)
234paramNames args env (p : ps)
216 | length args > p = case args!!p of
235 | length args > p = case args!!p of