on master help sign in
Remove priority ordering on function arguments

Should no longer be necessary since unification is improved, and causes problems when it guesses wrong.

commitf9678b7a44e0b7204b995d2c61aa8cc007e5ec94 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateWed 14 Nov 2012, 12:27 (14 years ago) parentb3e01d0
2 files changed+13−7
src/Core/Unify.hs+11−5 src/Idris/AbsSyntax.hs+2−2
src/Core/Unify.hs+11−5
@@ -28,14 +28,14 @@ unify ctxt env topx topy
2828 = -- case runStateT (un' False [] topx topy) (UI 0 [] []) of
2929 -- OK (v, UI _ inj []) -> return (filter notTrivial v, inj, [])
3030 -- _ ->
31−-- trace ("Unifying " ++ show (topx, topy)) $
31+-- trace ("Unifying " ++ show (topx, topy)) $
3232 let topxn = normalise ctxt env topx
3333 topyn = normalise ctxt env topy in
3434-- trace ("Unifying " ++ show (topxn, topyn)) $
3535 case runStateT (un' False [] topxn topyn)
3636 (UI 0 [] []) of
37− OK (v, UI _ inj fails) -> return (filter notTrivial v, inj, reverse fails)
38−-- OK (_, UI s _ ((_,_,f):fs)) -> tfail $ CantUnify topx topy f s
37+ OK (v, UI _ inj fails) ->
38+ return (filter notTrivial v, inj, reverse fails)
3939 Error e -> tfail e
4040 where
4141 notTrivial (x, P _ x' _) = x /= x'
@@ -75,12 +75,18 @@ unify ctxt env topx topy
7575 | (x,y) `elem` bnames = do sc 1; return []
7676 un' fn bnames (P Bound x _) tm
7777 | holeIn env x = do UI s i f <- get
78− when (notP tm && fn) $ put (UI s ((tm, topx, topy) : i) f)
78+ -- injectivity check
79+ when (notP tm && fn) $
80+-- trace (show (x, tm, normalise ctxt env tm)) $
81+ put (UI s ((tm, topx, topy) : i) f)
7982 sc 1
8083 checkCycle (x, tm)
8184 un' fn bnames tm (P Bound y _)
8285 | holeIn env y = do UI s i f <- get
83− when (notP tm && fn) $ put (UI s ((tm, topx, topy) : i) f)
86+ -- injectivity check
87+ when (notP tm && fn) $
88+-- trace (show (y, tm, normalise ctxt env tm)) $
89+ put (UI s ((tm, topx, topy) : i) f)
8490 sc 1
8591 checkCycle (y, tm)
8692 un' fn bnames (V i) (P Bound x _)
src/Idris/AbsSyntax.hs+2−2
@@ -577,13 +577,13 @@ mapsnd f (x, t) = (x, f t)
577577-- * finally, everything else (3)
578578
579579getPriority :: IState -> PTerm -> Int
580−getPriority i tm = pri tm
580+getPriority i tm = 1 -- pri tm
581581 where
582582 pri (PRef _ n) =
583583 case lookupP Nothing n (tt_ctxt i) of
584584 ((P (DCon _ _) _ _):_) -> 1
585585 ((P (TCon _ _) _ _):_) -> 1
586− ((P Ref _ _):_) -> 4
586+ ((P Ref _ _):_) -> 1
587587 [] -> 0 -- must be locally bound, if it's not an error...
588588 pri (PPi _ _ x y) = max 5 (max (pri x) (pri y))
589589 pri (PTrue _) = 0