[More ch23 work John Goerzen **20080213003230] { adddir ./examples/ch23 hunk ./en/ch23-webclient.xml 3 - + hunk ./en/ch23-webclient.xml 63 + + + We'll write the code for this chapter in pieces. Each piece will + be its own Haskell module. You'll be able to play with each piece + by itself in &ghci;. At the end, we'll write the final code that + ties everything together into a finished application. We'll start + with the basic types we'll need to use. + + + + Basic Types + + The first thing to do is have some idea of the basic information + that will be important to the application. This will generally + be information about the podcasts the user is interested in, + plus information about episodes that we have seen and + processed. It's easy enough to change this later if needed, but + since we'll be importing it just about everywhere, we'll define + it first. + + &PodTypes.hs:all; + + We'll be storing this information in a database. Having a + unique identifier for both a podcast and an episode makes it + easy to find which episodes belong to a particular podcast, load + information for a particular podcast or episode, or handle + future cases such as changing URLs for podcasts. + + + + + The Database + + FIXME + + addfile ./examples/ch23/PodTypes.hs hunk ./examples/ch23/PodTypes.hs 1 - +{-- snippet all --} +-- ch23/PodTypes.hs +module PodTypes where + +data Podcast = + Podcast {castId :: Integer, -- ^ Numeric ID for this podcast + castURL :: String -- ^ Its feed URL + } + deriving (Eq, Show, Read) + +data Episode = + Episode {epId :: Integer, -- ^ Numeric ID for this episode + epCastId :: Integer, -- ^ The ID of the podcast it came from + epURL :: String, -- ^ The download URL for this episode + epDone :: Bool -- ^ Whether or not we are done with this ep + } + deriving (Eq, Show, Read) +{-- /snippet all --} }