Show
Ignore:
Timestamp:
04/28/06 14:53:19 (3 years ago)
Author:
audreyt
Message:

* Data.FastPackedString? is now gone.
* Date.ByteString? joins us at third-party/.
* Pugs is now 2x faster on startup!

Files:
1 modified

Legend:

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

    r10059 r10107  
    1212import qualified Data.IntSet as IntSet 
    1313import qualified Data.IntMap as IntMap 
    14 import qualified Data.FastPackedString as Str 
     14import qualified Data.ByteString as Str 
    1515import DrIFT.YAML 
    1616 
     
    2626fromYaml :: YamlNode -> Eval Val 
    2727fromYaml MkYamlNode{el=YamlNil}       = return VUndef 
    28 fromYaml MkYamlNode{el=YamlStr str}   = return $ VStr $ decodeUTF8 $ Str.unpack str 
     28fromYaml MkYamlNode{el=YamlStr str}   = return $ VStr $ decodeUTF8 $ unpackBuf str 
    2929fromYaml MkYamlNode{el=YamlSeq nodes} = do 
    3030    vals    <- mapM fromYaml nodes 
     
    4242            return $ VRef (hashRef hv) 
    4343        Just s | (pre, post) <- Str.splitAt 16 s   -- 16 == length "tag:pugs:Object:" 
    44                , pre == Str.pack "tag:pugs:Object:" -> do 
    45             let typ = Str.unpack post 
     44               , pre == packBuf "tag:pugs:Object:" -> do 
     45            let typ = unpackBuf post 
    4646            vals    <- forM nodes $ \(keyNode, valNode) -> do 
    4747                key <- fromVal =<< fromYaml keyNode 
     
    4949                return (key, val) 
    5050            return . VObject =<< createObject (mkType typ) vals 
    51         Just s | s == Str.pack "tag:pugs:Rule" -> do 
     51        Just s | s == packBuf "tag:pugs:Rule" -> do 
    5252            vals    <- forM nodes $ \(keyNode, valNode) -> do 
    5353                key <- fromVal =<< fromYaml keyNode 
     
    6363            adverbs <- Map.lookup "adverbs" spec 
    6464            return $ VRule MkRulePGE{rxRule=rule, rxGlobal=global, rxStringify=stringify, rxAdverbs=adverbs} 
    65         Just x   -> error ("can't deserialize: " ++ (Str.unpack x)) 
     65        Just x   -> error ("can't deserialize: " ++ unpackBuf x) 
    6666 
    6767dumpYaml :: Val -> Eval Val 
     
    7474 
    7575strNode :: String -> YamlNode 
    76 strNode = mkNode . YamlStr . Str.pack 
     76strNode = mkNode . YamlStr . packBuf 
    7777 
    7878{- 
     
    109109    hash    <- fromVal v :: Eval VHash 
    110110    attrs   <- toYaml $ VRef (hashRef hash) 
    111     return $ tagNode (Just $ Str.pack $ "tag:pugs:Object:" ++ showType (objType obj)) attrs 
     111    return $ tagNode (Just $ packBuf $ "tag:pugs:Object:" ++ showType (objType obj)) attrs 
    112112toYaml (VRule MkRulePGE{rxRule=rule, rxGlobal=global, rxStringify=stringify, rxAdverbs=adverbs}) = do 
    113113    adverbs' <- toYaml adverbs