Changeset 14209

Show
Ignore:
Timestamp:
10/11/06 05:36:27 (2 years ago)
Author:
audreyt
Message:

* Pugs.Monads: Make "break" and "continue" dependent no

"when" frames, instead of on "given" frames. That means
"given" is now strictly a $_ aliasing device, and is not
considered a special construct on its own.

Location:
src/Pugs
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/AST/Internals.hs

    r14197 r14209  
    2121    VOpaque(..), -- uses Value 
    2222    VControl(..), -- uses Env, Eval, Val 
    23     ControlLoop(..), ControlGiven(..), Frame(..), 
     23    ControlLoop(..), ControlWhen(..), Frame(..), 
    2424    VScalar, -- uses Val 
    2525    VPair, -- uses Val 
     
    807807    | ControlEnv   !Env 
    808808    | ControlLoop  !ControlLoop 
    809     | ControlGiven !ControlGiven 
     809    | ControlWhen  !ControlWhen 
    810810    | ControlLeave 
    811811        { leaveType     :: !(SubType -> Bool) 
     
    822822    deriving (Show, Eq, Ord, Typeable) -- don't derive YAML for now 
    823823 
    824 data ControlGiven 
    825     = GivenContinue 
    826     | GivenBreak 
     824data ControlWhen 
     825    = WhenContinue 
     826    | WhenBreak 
    827827    deriving (Show, Eq, Ord, Typeable) -- don't derive YAML for now 
    828828 
     
    12781278data Frame 
    12791279    = FrameLoop 
    1280     | FrameGiven 
     1280    | FrameWhen 
    12811281    | FrameGather 
    12821282    | FrameRoutine 
  • src/Pugs/Monads.hs

    r14204 r14209  
    123123enterGather = enterFrame FrameGather 
    124124enterLoop   = enterFrame FrameLoop 
    125 enterGiven  = enterFrame FrameGiven 
     125enterGiven  = id 
    126126 
    127127assertFrame :: Frame -> Eval a -> Eval a 
     
    144144          -> Eval Val 
    145145enterWhen action = do 
    146     rv  <- action 
     146    rv  <- enterFrame FrameWhen action 
    147147    case rv of 
    148         VControl (ControlGiven GivenContinue)   -> retEmpty 
    149         VControl (ControlGiven GivenBreak)      -> retShiftEmpty 
    150         _                                       -> retShift rv 
     148        VControl (ControlWhen WhenContinue)   -> retEmpty 
     149        VControl (ControlWhen WhenBreak)      -> retShiftEmpty 
     150        _                                     -> retShift rv 
    151151 
    152152{-|