definition:
|
class ReadWrite a where
readRW :: Trie String -> String -> (a, String)
showRW :: RWParameters -> Trie String -> a -> (Trie String, ShowS)
writeRW :: RWParameters -> Handle -> a -> Trie String -> IO (Trie String)
--- Returns the type of the value.
typeOf :: a -> RWType
readListRW :: Trie String -> String -> ([a], String)
readListRW _ ('0' : cs) = ([], cs)
readListRW strs ('1' : cs) = (x : xs, r2)
where
(x,r1) = readRW strs cs
(xs,r2) = readListRW strs r1
showListRW :: RWParameters -> Trie String -> [a] -> (Trie String,ShowS)
showListRW _ strs [] = (strs, showString "0")
showListRW params strs (x : xs) = (strs'', showString "1" . x' . xs')
where
(strs',x') = showRW params strs x
(strs'',xs') = showListRW params strs' xs
writeListRW :: RWParameters -> Handle -> [a] -> Trie String -> IO (Trie String)
writeListRW _ h [] strs = hPutStr h "0" >> return strs
writeListRW params h (x : xs) strs =
hPutStr h "1" >> writeRW params h x strs >>= writeListRW params h xs
|
methods:
|
["readRW :: Data.Trie.Trie String -> String -> (a, String)","showRW :: RWParameters -> Data.Trie.Trie String -> a\n -> (Data.Trie.Trie String, String -> String)","writeRW :: RWParameters -> System.IO.Handle -> a -> Data.Trie.Trie String\n -> Prelude.IO (Data.Trie.Trie String)","typeOf :: a -> RWType","readListRW 2 :: Data.Trie.Trie String -> String -> ([a], String)","showListRW 3 :: RWParameters -> Data.Trie.Trie String -> [a]\n -> (Data.Trie.Trie String, String -> String)","writeListRW 4 :: RWParameters -> System.IO.Handle -> [a]\n -> Data.Trie.Trie String -> Prelude.IO (Data.Trie.Trie String)"]
|