Created
December 14, 2010 11:55
-
-
Save axelerator/740320 to your computer and use it in GitHub Desktop.
first steps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Arrows #-} | |
module Pickle where | |
import Control.Arrow | |
import Control.Arrow.ListArrow | |
import Text.XML.HXT.Arrow.Pickle | |
import Text.XML.HXT.Arrow.ReadDocument | |
data Strukt = Strukt { | |
text :: String | |
} deriving (Show, Eq) | |
main = do | |
putStrLn $ show $ load xml1 | |
xml1 = "<strukt>ssss</strukt>" | |
instance XmlPickler Strukt where | |
xpickle = xpStrukt | |
xpStrukt :: PU Strukt | |
xpStrukt = xpElem "strukt" $ xpWrap (Strukt, text) $ xpText | |
load = listToMaybe . (runLA $ xread >>> (xunpickleVal xpStrukt)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment