module Web.Ohloh.ResultType (
ResultType(..),
xpResultType
) where
import Text.XML.HXT.Arrow.Pickle
import Web.Ohloh.Account
import Web.Ohloh.ActivityFact
import Web.Ohloh.Analysis
import Web.Ohloh.ContributorFact
import Web.Ohloh.ContributorLanguageFact
import Web.Ohloh.Enlistment
import Web.Ohloh.Factoid
import Web.Ohloh.Kudo
import Web.Ohloh.Language
import Web.Ohloh.Project
import Web.Ohloh.SizeFact
import Web.Ohloh.Stack
data ResultType =
AccountR Account |
ActivityFactR ActivityFact |
AnalysisR Analysis |
ContributorFactR ContributorFact |
ContributorLanguageFactR ContributorLanguageFact |
EnlistmentR Enlistment |
FactoidR Factoid |
KudoR Kudo |
LanguageR Language |
ProjectR Project |
SizeFactR SizeFact |
StackR Stack
deriving (Eq, Read, Show)
instance XmlPickler ResultType where
xpickle = xpResultType
xpResultType :: PU ResultType
xpResultType = xpAlt tag ps
where
tag (AccountR _) = 0
tag (ActivityFactR _) = 1
tag (AnalysisR _) = 2
tag (ContributorFactR _) = 3
tag (ContributorLanguageFactR _) = 4
tag (EnlistmentR _) = 5
tag (FactoidR _) = 6
tag (KudoR _) = 7
tag (LanguageR _) = 8
tag (ProjectR _) = 9
tag (SizeFactR _) = 10
tag (StackR _) = 11
ps = [
xpWrap (AccountR, \(AccountR x) -> x)
xpAccount,
xpWrap (ActivityFactR, \(ActivityFactR x) -> x)
xpActivityFact,
xpWrap (AnalysisR, \(AnalysisR x) -> x)
xpAnalysis,
xpWrap (ContributorFactR, \(ContributorFactR x) -> x)
xpContributorFact,
xpWrap (ContributorLanguageFactR, \(ContributorLanguageFactR x) -> x)
xpContributorLanguageFact,
xpWrap (EnlistmentR, \(EnlistmentR x) -> x)
xpEnlistment,
xpWrap (FactoidR, \(FactoidR x) -> x)
xpFactoid,
xpWrap (KudoR, \(KudoR x) -> x)
xpKudo,
xpWrap (LanguageR, \(LanguageR x) -> x)
xpLanguage,
xpWrap (ProjectR, \(ProjectR x) -> x)
xpProject,
xpWrap (SizeFactR, \(SizeFactR x) -> x)
xpSizeFact,
xpWrap (StackR, \(StackR x) -> x)
xpStack
]