Changeset 5807 for src/Pugs/Bind.hs

Show
Ignore:
Timestamp:
07/26/05 11:39:00 (3 years ago)
Author:
autrijus
svk:copy_cache_prev:
7758
Message:

* Fix pair binding: For functions expecting pairs as arguments,

their Pair arguments should engate in positional binding,
not named bindings phase. Implemented with the hack of
(Syn "=>") representing a pair as named argument, and the
original (App (Var "&infix:=>")) now means positional during
the binding phase.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Bind.hs

    r5689 r5807  
    4444        = ( ((prm, exp) : bound), exps ) 
    4545        | otherwise 
    46         = ( bound, (App (Var "&infix:=>") Nothing [Val (VStr name), exp]:exps) ) 
     46        = ( bound, (Syn "=>" [Val (VStr name), exp]:exps) ) 
    4747 
    4848 
     
    148148isPair (Pos _ exp) = isPair exp 
    149149isPair (Cxt _ exp) = isPair exp 
    150 isPair (App (Var "&infix:=>") Nothing [(Cxt _ (Val _)), _])   = True 
    151 isPair (App (Var "&infix:=>") Nothing [(Val _), _])   = True 
     150isPair (Syn "=>" [(Cxt _ (Val _)), _])   = True 
     151isPair (Syn "=>" [(Val _), _])   = True 
    152152isPair _                         = False 
    153153 
     
    159159unPair (Pos _ exp) = unPair exp 
    160160unPair (Cxt _ exp) = unPair exp 
    161 unPair (App (Var "&infix:=>") Nothing [key, exp]) 
     161unPair (Syn "=>" [key, exp]) 
    162162    | Val (VStr k) <- unwrap key = (k, exp) 
    163163unPair x = error ("Not a pair: " ++ show x)