Skip to content

Instantly share code, notes, and snippets.

@axelerator axelerator/Pickle.hs
Created Dec 14, 2010

Embed
What would you like to do?
first steps
{-# 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
You can’t perform that action at this time.