@@ -71,33 +71,28 @@ checkAddDef add toplvl fc ((n, (i, top, t)) : ns)
7171-- mapM (\(n, (i, top, t)) -> do (t', _) <- recheckC fc [] t
7272-- return (n, (i, top, t'))) ns
7373
74−-- | Elaborate a top-level type declaration - for example, "foo : Int -> Int".
75−elabType :: ElabInfo -> SyntaxInfo -> Docstring -> [(Name, Docstring)] ->
76− FC -> FnOpts -> Name -> PTerm -> Idris Type
77−elabType = elabType' False
78−
79−elabType' :: Bool -> -- normalise it
80− ElabInfo -> SyntaxInfo -> Docstring -> [(Name, Docstring)] ->
81− FC -> FnOpts -> Name -> PTerm -> Idris Type
82−elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params info) ty_in
83− n = liftname info n_in in -}
84− do checkUndefined fc n
74+buildType :: ElabInfo -> SyntaxInfo -> FC -> FnOpts -> Name -> PTerm ->
75+ Idris (Type, PTerm, [(Int, Name)])
76+buildType info syn fc opts n ty' = do
8577 ctxt <- getContext
8678 i <- getIState
8779
88− logLvl 5 $ show n ++ " pre-type " ++ showTmImpls ty'
80+ logLvl 3 $ show n ++ " pre-type " ++ showTmImpls ty'
8981 ty' <- addUsingConstraints syn fc ty'
90− ty' <- implicit info syn n ty'
82+ ty' <- addUsingImpls syn n fc ty'
83+ let ty = addImpl i ty'
9184
92− let ty = addImpl i ty'
93− inacc = inaccessibleArgs 0 ty
94− logLvl 5 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
95− logLvl 5 $ show n ++ " type " ++ showTmImpls ty
96− logLvl 3 $ show n ++ ": inaccessible arguments: " ++ show inacc
85+ logLvl 3 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
86+ logLvl 3 $ show n ++ " type " ++ show (using syn) ++ "\n" ++ showTmImpls ty
9787
98− ((tyT, defer, is), log) <-
88+ ((tyT', defer, is), log) <-
9989 tclift $ elaborate ctxt n (TType (UVal 0)) []
100− (errAt "type of " n (erun fc (build i info False [] n ty)))
90+ (errAt "type of " n (erun fc (build i info ETyDecl [] n ty)))
91+
92+ let tyT = patToImp tyT'
93+
94+ logLvl 3 $ show ty ++ "\nElaborated: " ++ show tyT'
95+
10196 ds <- checkAddDef True False fc defer
10297 -- if the type is not complete, note that we'll need to infer
10398 -- things later (for solving metavariables)
@@ -107,19 +102,52 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
107102 ctxt <- getContext
108103 logLvl 5 $ "Rechecking"
109104 logLvl 6 $ show tyT
105+ logLvl 10 $ "Elaborated to " ++ showEnvDbg [] tyT
110106 (cty, _) <- recheckC fc [] tyT
111− addStatics n cty ty'
112− logLvl 6 $ "Elaborated to " ++ showEnvDbg [] tyT
107+
108+ -- record the implicit and inaccessible arguments
109+ i <- getIState
110+ let (inaccData, impls) = unzip $ getUnboundImplicits i cty ty
111+ let inacc = inaccessibleImps 0 cty inaccData
112+ logLvl 3 $ show n ++ ": inaccessible arguments: " ++ show inacc
113+
114+ putIState $ i { idris_implicits = addDef n impls (idris_implicits i) }
115+ logLvl 3 ("Implicit " ++ show n ++ " " ++ show impls)
116+ addIBC (IBCImp n)
117+
118+ return (cty, ty, inacc)
119+ where
120+ patToImp (Bind n (PVar t) sc) = Bind n (Pi t) (patToImp sc)
121+ patToImp (Bind n b sc) = Bind n b (patToImp sc)
122+ patToImp t = t
123+
124+
125+-- | Elaborate a top-level type declaration - for example, "foo : Int -> Int".
126+elabType :: ElabInfo -> SyntaxInfo -> Docstring -> [(Name, Docstring)] ->
127+ FC -> FnOpts -> Name -> PTerm -> Idris Type
128+elabType = elabType' False
129+
130+elabType' :: Bool -> -- normalise it
131+ ElabInfo -> SyntaxInfo -> Docstring -> [(Name, Docstring)] ->
132+ FC -> FnOpts -> Name -> PTerm -> Idris Type
133+elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params info) ty_in
134+ n = liftname info n_in in -}
135+ do checkUndefined fc n
136+ (cty, ty, inacc) <- buildType info syn fc opts n ty'
137+
138+ addStatics n cty ty
113139 logLvl 2 $ "Rechecked to " ++ show cty
114140 let nty = cty -- normalise ctxt [] cty
115141 -- if the return type is something coinductive, freeze the definition
142+ ctxt <- getContext
116143 let nty' = normalise ctxt [] nty
117144
118145 -- Add normalised type to internals
146+ i <- getIState
119147 rep <- useREPL
120148 when rep $ do
121− addInternalApp (fc_fname fc) (fst . fc_start $ fc) (mergeTy ty' (delab i nty')) -- TODO: Should use span instead of line and filename?
122− addIBC (IBCLineApp (fc_fname fc) (fst . fc_start $ fc) (mergeTy ty' (delab i nty')))
149+ addInternalApp (fc_fname fc) (fst . fc_start $ fc) ty' -- (mergeTy ty' (delab i nty')) -- TODO: Should use span instead of line and filename?
150+ addIBC (IBCLineApp (fc_fname fc) (fst . fc_start $ fc) ty') -- (mergeTy ty' (delab i nty')))
123151
124152 let (t, _) = unApply (getRetTy nty')
125153 let corec = case t of
@@ -163,7 +191,7 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
163191 -- for making an internalapp, we only want the explicit ones, and don't
164192 -- want the parameters, so just take the arguments which correspond to the
165193 -- user declared explicit ones
166− mergeTy (PPi e n ty sc) (PPi e' _ _ sc')
194+ mergeTy (PPi e n ty sc) (PPi e' n' _ sc')
167195 | e == e' = PPi e n ty (mergeTy sc sc')
168196 | otherwise = mergeTy sc sc'
169197 mergeTy _ sc = sc
@@ -184,6 +212,14 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
184212 , ns4 == map txt ["Errors","Reflection","Language"] = True
185213 tyIsHandler _ = False
186214
215+-- Get the list of (index, name) of inaccessible arguments from an elaborated
216+-- type
217+inaccessibleImps :: Int -> Type -> [Bool] -> [(Int, Name)]
218+inaccessibleImps i (Bind n (Pi t) sc) (inacc : ins)
219+ | inacc = (i, n) : inaccessibleImps (i + 1) sc ins
220+ | otherwise = inaccessibleImps (i + 1) sc ins
221+inaccessibleImps _ _ _ = []
222+
187223-- Get the list of (index, name) of inaccessible arguments from the type.
188224inaccessibleArgs :: Int -> PTerm -> [(Int, Name)]
189225inaccessibleArgs i (PPi (Imp _ _ _) n Placeholder t)
@@ -210,42 +246,20 @@ elabData info syn doc argDocs fc opts (PLaterdecl n t_in)
210246 = do let codata = Codata `elem` opts
211247 iLOG (show (fc, doc))
212248 checkUndefined fc n
213− ctxt <- getContext
214− i <- getIState
215− -- TODO think: something more in info?
216− t_in <- implicit info syn n t_in
217− let t = addImpl i t_in
218− ((t', defer, is), log) <- tclift $ elaborate ctxt n (TType (UVal 0)) []
219− (erun fc (build i info False [] n t))
220− def' <- checkDef fc defer
221− let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
222− addDeferredTyCon def''
249+ (cty, t, inacc) <- buildType info syn fc [] n t_in
250+
223251 addIBC (IBCDef n)
224− mapM_ (elabCaseBlock info []) is
225− (cty, _) <- recheckC fc [] t'
226− logLvl 2 $ "---> " ++ show cty
227252 updateContext (addTyDecl n (TCon 0 0) cty) -- temporary, to check cons
228253
229254elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
230255 = do let codata = Codata `elem` opts
231256 iLOG (show fc)
232257 undef <- isUndefined fc n
233− ctxt <- getContext
234− i <- getIState
235− t_in <- implicit info syn n t_in
236− let t = addImpl i t_in
237− ((t', defer, is), log) <-
238− tclift $ elaborate ctxt n (TType (UVal 0)) []
239− (errAt "data declaration " n (erun fc (build i info False [] n t)))
240− def' <- checkDef fc defer
241− let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
258+ (cty, t, inacc) <- buildType info syn fc [] n t_in
242259 -- if n is defined already, make sure it is just a type declaration
243260 -- with the same type we've just elaborated
244− checkDefinedAs fc n t' (tt_ctxt i)
245− addDeferredTyCon def''
246− mapM_ (elabCaseBlock info []) is
247− (cty, _) <- recheckC fc [] t'
248− logLvl 2 $ "---> " ++ show cty
261+ i <- getIState
262+ checkDefinedAs fc n cty (tt_ctxt i)
249263 -- temporary, to check cons
250264 when undef $ updateContext (addTyDecl n (TCon 0 0) cty)
251265 let cnameinfo = cinfo info (map cname dcons)
@@ -262,7 +276,7 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
262276 (idris_datatypes i) })
263277 addIBC (IBCDef n)
264278 addIBC (IBCData n)
265− checkDocs fc argDocs t_in
279+ checkDocs fc argDocs t
266280 addDocStr n doc argDocs
267281 addIBC (IBCDoc n)
268282 let metainf = DataMI params
@@ -368,6 +382,56 @@ elabData info syn doc argDocs fc opts (PDatadecl n t_in dcons)
368382 liftname = id -- Is this appropriate?
369383 }
370384
385+-- FIXME: 'forcenames' is an almighty hack! Need a better way of
386+-- erasing non-forceable things
387+-- ^^^
388+-- TODO: the above is a comment from the past;
389+-- forcenames is probably no longer needed
390+elabCon :: ElabInfo -> SyntaxInfo -> Name -> Bool ->
391+ (Docstring, [(Name, Docstring)], Name, PTerm, FC, [Name]) -> Idris (Name, Type)
392+elabCon info syn tn codata (doc, argDocs, n, t_in, fc, forcenames)
393+ = do checkUndefined fc n
394+ (cty, t, inacc) <- buildType info syn fc [] n (if codata then mkLazy t_in else t_in)
395+ ctxt <- getContext
396+ let cty' = normalise ctxt [] cty
397+
398+ logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
399+ logLvl 5 $ "Inaccessible args: " ++ show inacc
400+ logLvl 2 $ "---> " ++ show n ++ " : " ++ show cty'
401+
402+ addIBC (IBCDef n)
403+ checkDocs fc argDocs t
404+ addDocStr n doc argDocs
405+ addIBC (IBCDoc n)
406+ fputState (opt_inaccessible . ist_optimisation n) inacc
407+ addIBC (IBCOpt n)
408+ return (n, cty')
409+ where
410+ tyIs (Bind n b sc) = tyIs sc
411+ tyIs t | (P _ n' _, _) <- unApply t
412+ = if n' /= tn then tclift $ tfail (At fc (Msg (show n' ++ " is not " ++ show tn)))
413+ else return ()
414+ tyIs t = tclift $ tfail (At fc (Msg (show t ++ " is not " ++ show tn)))
415+
416+ mkLazy (PPi pl n ty sc)
417+ = let ty' = if getTyName ty
418+ then PApp fc (PRef fc (sUN "Lazy'"))
419+ [pexp (PRef fc (sUN "LazyCodata")),
420+ pexp ty]
421+ else ty in
422+ PPi pl n ty' (mkLazy sc)
423+ mkLazy t = t
424+
425+ getTyName (PApp _ (PRef _ n) _) = n == nsroot tn
426+ getTyName (PRef _ n) = n == nsroot tn
427+ getTyName _ = False
428+
429+
430+ getNamePos :: Int -> PTerm -> Name -> Maybe Int
431+ getNamePos i (PPi _ n _ sc) x | n == x = Just i
432+ | otherwise = getNamePos (i + 1) sc x
433+ getNamePos _ _ _ = Nothing
434+
371435type EliminatorState = StateT (Map.Map String Int) Idris
372436
373437-- TODO: Rewrite everything to use idris_implicits instead of manual splitting (or in TT)
@@ -699,15 +763,15 @@ elabProvider info syn fc what n
699763 -- First elaborate the expected type (and check that it's a type)
700764 -- The goal type for a postulate is always Type.
701765 (ty', typ) <- case what of
702− ProvTerm ty p -> elabVal toplevel False ty
703− ProvPostulate _ -> elabVal toplevel False PType
766+ ProvTerm ty p -> elabVal toplevel ERHS ty
767+ ProvPostulate _ -> elabVal toplevel ERHS PType
704768 unless (isTType typ) $
705769 ifail ("Expected a type, got " ++ show ty' ++ " : " ++ show typ)
706770
707771 -- Elaborate the provider term to TT and check that the type matches
708772 (e, et) <- case what of
709− ProvTerm _ tm -> elabVal toplevel False tm
710− ProvPostulate tm -> elabVal toplevel False tm
773+ ProvTerm _ tm -> elabVal toplevel ERHS tm
774+ ProvPostulate tm -> elabVal toplevel ERHS tm
711775 unless (isProviderOf (normalise ctxt [] ty') et) $
712776 ifail $ "Expected provider type IO (Provider (" ++
713777 show ty' ++ "))" ++ ", got " ++ show et ++ " instead."
@@ -756,7 +820,7 @@ elabTransform info fc safe lhs_in rhs_in
756820 let lhs = addImplPat i lhs_in
757821 ((lhs', dlhs, []), _) <-
758822 tclift $ elaborate ctxt (sMN 0 "transLHS") infP []
759− (erun fc (buildTC i info True [] (sUN "transform")
823+ (erun fc (buildTC i info ELHS [] (sUN "transform")
760824 (infTerm lhs)))
761825 let lhs_tm = orderPats (getInferTerm lhs')
762826 let lhs_ty = getInferType lhs'
@@ -769,7 +833,7 @@ elabTransform info fc safe lhs_in rhs_in
769833 tclift $ elaborate ctxt (sMN 0 "transRHS") clhs_ty []
770834 (do pbinds i lhs_tm
771835 setNextName
772− erun fc (build i info False [] (sUN "transform") rhs)
836+ erun fc (build i info ERHS [] (sUN "transform") rhs)
773837 erun fc $ psolve lhs_tm
774838 tt <- get_term
775839 return (runState (collectDeferred Nothing tt) []))
@@ -945,70 +1009,6 @@ elabRecord info syn doc fc tyn ty opts cdoc cn cty_in
9451009 then PPi impl n' ty (implBindUp ns is t)
9461010 else implBindUp ns is t
9471011
948−-- FIXME: 'forcenames' is an almighty hack! Need a better way of
949−-- erasing non-forceable things
950−-- ^^^
951−-- TODO: the above is a comment from the past;
952−-- forcenames is probably no longer needed
953−elabCon :: ElabInfo -> SyntaxInfo -> Name -> Bool ->
954− (Docstring, [(Name, Docstring)], Name, PTerm, FC, [Name]) -> Idris (Name, Type)
955−elabCon info syn tn codata (doc, argDocs, n, t_in, fc, forcenames)
956− = do checkUndefined fc n
957− ctxt <- getContext
958− i <- getIState
959− t_in <- implicit info syn n (if codata then mkLazy t_in else t_in)
960− let t = addImpl i t_in
961− logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
962− let inacc = inaccessibleArgs 0 t
963− logLvl 5 $ "Inaccessible args: " ++ show inacc
964− ((t', defer, is), log) <-
965− tclift $ elaborate ctxt n (TType (UVal 0)) []
966− (errAt "constructor " n (erun fc (build i info False [] n t)))
967− logLvl 2 $ "Rechecking " ++ show t'
968− def' <- checkDef fc defer
969− let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
970− addDeferred def''
971− mapM_ (\(n, _) -> addIBC (IBCDef n)) def''
972−
973− mapM_ (elabCaseBlock info []) is
974− ctxt <- getContext
975− (cty, _) <- recheckC fc [] t'
976− let cty' = normaliseC ctxt [] cty
977− tyIs cty'
978− logLvl 2 $ "---> " ++ show n ++ " : " ++ show cty'
979− addIBC (IBCDef n)
980− checkDocs fc argDocs t_in
981− addDocStr n doc argDocs
982− addIBC (IBCDoc n)
983− fputState (opt_inaccessible . ist_optimisation n) inacc
984− addIBC (IBCOpt n)
985− return (n, cty')
986− where
987− tyIs (Bind n b sc) = tyIs sc
988− tyIs t | (P _ n' _, _) <- unApply t
989− = if n' /= tn then tclift $ tfail (At fc (Msg (show n' ++ " is not " ++ show tn)))
990− else return ()
991− tyIs t = tclift $ tfail (At fc (Msg (show t ++ " is not " ++ show tn)))
992−
993− mkLazy (PPi pl n ty sc)
994− = let ty' = if getTyName ty
995− then PApp fc (PRef fc (sUN "Lazy'"))
996− [pexp (PRef fc (sUN "LazyCodata")),
997− pexp ty]
998− else ty in
999− PPi pl n ty' (mkLazy sc)
1000− mkLazy t = t
1001−
1002− getTyName (PApp _ (PRef _ n) _) = n == nsroot tn
1003− getTyName (PRef _ n) = n == nsroot tn
1004− getTyName _ = False
1005−
1006−
1007− getNamePos :: Int -> PTerm -> Name -> Maybe Int
1008− getNamePos i (PPi _ n _ sc) x | n == x = Just i
1009− | otherwise = getNamePos (i + 1) sc x
1010− getNamePos _ _ _ = Nothing
1011−
10121012-- | Elaborate a collection of left-hand and right-hand pairs - that is, a
10131013-- top-level definition.
10141014elabClauses :: ElabInfo -> FC -> FnOpts -> Name -> [PClause] -> Idris ()
@@ -1322,7 +1322,7 @@ elabPE info fc caller r =
13221322
13231323-- Elaborate a value, returning any new bindings created (this will only
13241324-- happen if elaborating as a pattern clause)
1325−elabValBind :: ElabInfo -> Bool -> Bool -> PTerm -> Idris (Term, Type, [(Name, Type)])
1325+elabValBind :: ElabInfo -> ElabMode -> Bool -> PTerm -> Idris (Term, Type, [(Name, Type)])
13261326elabValBind info aspat norm tm_in
13271327 = do ctxt <- getContext
13281328 i <- getIState
@@ -1356,7 +1356,7 @@ elabValBind info aspat norm tm_in
13561356
13571357 return (vtm, vty, bargs)
13581358
1359−elabVal :: ElabInfo -> Bool -> PTerm -> Idris (Term, Type)
1359+elabVal :: ElabInfo -> ElabMode -> PTerm -> Idris (Term, Type)
13601360elabVal info aspat tm_in
13611361 = do (tm, ty, _) <- elabValBind info aspat False tm_in
13621362 return (tm, ty)
@@ -1371,7 +1371,7 @@ checkPossible info fc tcgen fname lhs_in
13711371 let lhs = addImplPat i lhs_in
13721372 -- if the LHS type checks, it is possible
13731373 case elaborate ctxt (sMN 0 "patLHS") infP []
1374− (erun fc (buildTC i info True [] fname (infTerm lhs))) of
1374+ (erun fc (buildTC i info ELHS [] fname (infTerm lhs))) of
13751375 OK ((lhs', _, _), _) ->
13761376 do let lhs_tm = orderPats (getInferTerm lhs')
13771377 case recheck ctxt [] (forget lhs_tm) lhs_tm of
@@ -1524,7 +1524,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
15241524 (((lhs', dlhs, []), probs, inj), _) <-
15251525 tclift $ elaborate ctxt (sMN 0 "patLHS") infP []
15261526 (do res <- errAt "left hand side of " fname
1527− (erun fc (buildTC i info True opts fname (infTerm lhs)))
1527+ (erun fc (buildTC i info ELHS opts fname (infTerm lhs)))
15281528 probs <- get_probs
15291529 inj <- get_inj
15301530 return (res, probs, inj))
@@ -1582,7 +1582,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in withs rhs_in whereblock)
15821582 mapM_ setinj (nub (params ++ inj))
15831583 setNextName
15841584 (_, _, is) <- errAt "right hand side of " fname
1585− (erun fc (build i winfo False opts fname rhs))
1585+ (erun fc (build i winfo ERHS opts fname rhs))
15861586 errAt "right hand side of " fname
15871587 (erun fc $ psolve lhs_tm)
15881588 hs <- get_holes
@@ -1716,7 +1716,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
17161716 ((lhs', dlhs, []), _) <-
17171717 tclift $ elaborate ctxt (sMN 0 "patLHS") infP []
17181718 (errAt "left hand side of with in " fname
1719− (erun fc (buildTC i info True opts fname (infTerm lhs))) )
1719+ (erun fc (buildTC i info ELHS opts fname (infTerm lhs))) )
17201720 let lhs_tm = orderPats (getInferTerm lhs')
17211721 let lhs_ty = getInferType lhs'
17221722 let ret_ty = getRetTy lhs_ty
@@ -1734,7 +1734,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
17341734 setNextName
17351735 -- TODO: may want where here - see winfo abpve
17361736 (_', d, is) <- errAt "with value in " fname
1737− (erun fc (build i info False opts fname (infTerm wval)))
1737+ (erun fc (build i info ERHS opts fname (infTerm wval)))
17381738 erun fc $ psolve lhs_tm
17391739 tt <- get_term
17401740 return (tt, d, is))
@@ -1797,7 +1797,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in withblock)
17971797 tclift $ elaborate ctxt (sMN 0 "wpatRHS") clhsty []
17981798 (do pbinds i lhs_tm
17991799 setNextName
1800− (_, d, is) <- erun fc (build i info False opts fname rhs)
1800+ (_, d, is) <- erun fc (build i info ERHS opts fname rhs)
18011801 psolve lhs_tm
18021802 tt <- get_term
18031803 return (tt, d, is))
@@ -1874,11 +1874,14 @@ data MArgTy = IA | EA | CA deriving Show
18741874elabClass :: ElabInfo -> SyntaxInfo -> Docstring ->
18751875 FC -> [PTerm] ->
18761876 Name -> [(Name, PTerm)] -> [(Name, Docstring)] -> [PDecl] -> Idris ()
1877−elabClass info syn doc fc constraints tn ps pDocs ds
1877+elabClass info syn_in doc fc constraints tn ps pDocs ds
18781878 = do let cn = SN (InstanceCtorN tn) -- sUN ("instance" ++ show tn) -- MN 0 ("instance" ++ show tn)
18791879 let tty = pibind ps PType
18801880 let constraint = PApp fc (PRef fc tn)
18811881 (map (pexp . PRef fc) (map fst ps))
1882+
1883+ let syn = syn_in { using = addToUsing (using syn_in) ps }
1884+
18821885 -- build data declaration
18831886 let mdecls = filter tydecl ds -- method declarations
18841887 let idecls = filter instdecl ds -- default superclass instance declarations
@@ -1904,12 +1907,12 @@ elabClass info syn doc fc constraints tn ps pDocs ds
19041907 elabData info (syn { no_imp = no_imp syn ++ mnames }) doc pDocs fc [] ddecl
19051908 -- for each constraint, build a top level function to chase it
19061909 logLvl 5 $ "Building functions"
1907− let usyn = syn { using = map (\ (x,y) -> UImplicit x y) ps
1908− ++ using syn }
1909− fns <- mapM (cfun cn constraint usyn (map fst imethods)) constraints
1910+-- let usyn = syn { using = map (\ (x,y) -> UImplicit x y) ps
1911+-- ++ using syn }
1912+ fns <- mapM (cfun cn constraint syn (map fst imethods)) constraints
19101913 mapM_ (elabDecl EAll info) (concat fns)
19111914 -- for each method, build a top level function
1912− fns <- mapM (tfun cn constraint usyn (map fst imethods)) imethods
1915+ fns <- mapM (tfun cn constraint syn (map fst imethods)) imethods
19131916 mapM_ (elabDecl EAll info) (concat fns)
19141917 -- add the default definitions
19151918 mapM_ (elabDecl EAll info) (concat (map (snd.snd) defs))
@@ -2154,7 +2157,7 @@ elabInstance info syn what fc cs n ps t expn ds = do
21542157 ctxt <- getContext
21552158 ((tyT, _, _), _) <-
21562159 tclift $ elaborate ctxt iname (TType (UVal 0)) []
2157− (errAt "type of " iname (erun fc (build i info False [] iname ty)))
2160+ (errAt "type of " iname (erun fc (build i info ERHS [] iname ty)))
21582161 ctxt <- getContext
21592162 (cty, _) <- recheckC fc [] tyT
21602163 let nty = normalise ctxt [] cty