Changeset 9070 for src/Pugs/Prim/Yaml.hs

Show
Ignore:
Timestamp:
02/20/06 06:22:07 (3 years ago)
Author:
audreyt
Message:

* Prim.Yaml: &code.yaml and other non-array, non-hash

elements is now serialized by simply calling to DrIFT.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Yaml.hs

    r9039 r9070  
    1414import qualified Data.IntMap as IntMap 
    1515import qualified Data.FastPackedString as Str 
    16 import Foreign.StablePtr 
    17 import Foreign.Ptr 
    18 import Data.Generics 
     16import DrIFT.YAML 
    1917 
    2018type Str = Str.FastString 
     
    8179strNode = mkNode . YamlStr . Str.pack 
    8280 
     81{- 
    8382addressOf :: a -> IO Int 
    8483addressOf x = do 
    8584    ptr <- newStablePtr x 
    8685    return (castStablePtrToPtr ptr `minusPtr` (nullPtr :: Ptr ())) 
     86-} 
    8787 
    8888toYaml :: (?seen :: IntSet.IntSet) => Val -> Eval YamlNode 
     
    9797            v'      <- readRef r 
    9898            nodes   <- toYaml v' 
    99             ifValTypeIsa v "Array" (return nodes) . return $ case v' of 
    100                 VObject _   -> nodes 
    101                 _           -> mkNode $ YamlMap [(strNode "<ref>", nodes)] 
     99            ifValTypeIsa v "Array" (return nodes) $ case v' of 
     100                VObject _   -> return nodes 
     101                _           -> liftIO $ toYamlNode r 
    102102        return node{ anchor = MkYamlAnchor ptr } 
    103103toYaml (VList nodes) = do