Changeset 13273 for src/Pugs/Val

Show
Ignore:
Timestamp:
09/13/06 22:55:25 (2 years ago)
Author:
gaal
Message:

* partial support for stringifying unpacky sigs; fails some tests.

(touch src/Pugs/Val.hs to get this to compile)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Val/Code.hs

    r13260 r13273  
    161161 
    162162prettyParam :: Param -> Bool -> Bool -> Doc 
    163 prettyParam p isReq isPos = staticTypes <+> varName <> defaultHint <+> 
    164     (if haveDefault then equals <+> text "..." else empty) <+> acc <+> ref <+> lazy <+> 
    165     slots <+> constraints <+> debugDump 
     163prettyParam p isReq isPos = staticTypes <+> varName <> defaultHint <+> sep 
     164    [ traits, unpacking, constraints, debugDump ] 
    166165    where 
    167166    varName 
     
    173172    defaultHint = if not isReq && not haveDefault then text "?" else empty 
    174173    haveDefault = isJust $ unDefault $ p_default p 
    175     acc = case p_hasAccess p of 
     174    defaultVal  = if haveDefault then equals <+> text "..." else empty 
     175    traits      = sep [acc, ref, lazy, slots] 
     176    unpacking   = case p_unpacking p of 
     177        (Just s)   -> purePretty s 
     178        _          -> empty 
     179    acc         = case p_hasAccess p of 
    176180        AccessRO   -> empty 
    177181        AccessRW   -> text "is rw" 
    178182        AccessCopy -> text "is copy" 
    179     ref   = if p_isRef  p then text "is ref"  else empty 
    180     lazy  = if p_isLazy p then text "is lazy" else empty 
     183    ref         = if p_isRef  p then text "is ref"  else empty 
     184    lazy        = if p_isLazy p then text "is lazy" else empty 
    181185    -- slots = hsep [text ("is " ++ (cast aux)) <+> text "..." | (aux, val) <- Map.toList $ p_slots p] XXX: for when traits have args 
    182     slots = hsep [text ("is " ++ (cast $ fst trait)) | trait <- Map.toList $ p_slots p] 
     186    slots       = hsep [text ("is " ++ (cast $ fst trait)) | trait <- Map.toList $ p_slots p] 
    183187    constraints = hsep $ replicate (length $ p_constraints p) (text "where {...}") 
    184     debugDump = if True then empty else braces $ text $ show p -- XXX delme 
     188    debugDump   = if True then empty else braces $ text $ show p -- XXX delme 
    185189-------------------------------------------------------------------------------------- 
    186190