-- | This module describes the state of shpider computations, and provides a monad transformer over it.moduleNetwork.Shpider.State(moduleControl.Monad.State,ShpiderState(..),Page(..),Shpider,emptyPage,runShpider,runShpiderSt)whereimportControl.Monad.StateimportNetwork.Shpider.Curl.CurlimportData.MaybeimportText.HTML.TagSoup.ParsecimportNetwork.Shpider.FormsimportNetwork.Shpider.Links-- | The shpider state holds all the options for shpider transactions, the current page and all the `CurlOption`s used when calling curl.dataShpiderState=SS{htmlOnlyDownloads::Bool,startPage::String,dontLeaveDomain::Bool,curlOpts::[CurlOption],currentPage::Page,visited::Maybe[String]}derivingShow-- | The type of Shpider computations. A state transformer over `ShpiderState` and `IO`.typeShpider=StateTShpiderStateIO-- | Run a Shpider computation, returning the result with the state.runShpiderSt::Shpidera->IO(a,ShpiderState)runShpiderStf=withCurlDo$runStateTfinitialSt-- | Run a Shpider computation, returning the result.runShpider::Shpidera->IOarunShpiderf=do(res,_)<-runShpiderStfreturnres-- | The initial shpider state.-- Currently, CurlTimeout is hard wired to 3, and cookies are saved in a file called "cookies".initialSt::ShpiderStateinitialSt=SS{startPage="",htmlOnlyDownloads=False,dontLeaveDomain=False,curlOpts=[CurlTimeout3,CurlCookieFile"cookies",CurlCookieJar"cookies"],currentPage=emptyPage,visited=Nothing}-- | The Page datatype. Holds `Link`s, `Form`s, the parsed [ `Tag` ], the page source, and the page's absolute URL.dataPage=Page{links::[Link],forms::[Form],tags::[Tag],source::String,addr::String}derivingShow-- | An empty page, containing no information.emptyPage::PageemptyPage=Page{links=[],forms=[],source="",tags=[],addr=""}