{-# LANGUAGE CPP #-}-- | Module for "pure" things in the base, and things I think should-- have been in base, or could plausibly be added.moduleGeneral.Base(moduleGeneral.Base,moduleX)whereimportControl.ArrowasXimportControl.MonadasXimportData.CharasXimportData.DataasX(Data,Typeable)importData.EitherasXimportData.FunctionasXimportData.ListasXimportData.MaybeasXimportData.MonoidasXimportData.OrdasXimportData.StringasXimportDebug.TraceasX(trace)importNumericasX(readHex,showHex)importSystem.FilePathasXhiding(combine)importqualifiedData.ByteString.Char8asBSimportqualifiedData.ByteString.Lazy.Char8asLBSimportControl.Exception(bracket)importSystem.IOtypeLBString=LBS.ByteStringtypeBString=BS.ByteStringlbsUnpack=LBS.unpackbsUnpack=BS.unpack-- | A URL, or internet address. These addresses will usually start with either-- @http:\/\/@ or @file:\/\/@.typeURL=Stringfst3(a,b,c)=asnd3(a,b,c)=bthd3(a,b,c)=cswap(a,b)=(b,a)fromLeft(Leftx)=xfromRight(Rightx)=xisLeftLeft{}=True;isLeft_=FalseisRightRight{}=True;isRight_=FalseconcatMapMf=liftMconcat.mapMfunzipEithers::[Eitherab]->([a],[b])unzipEithers[]=([],[])unzipEithers(Leftx:xs)=(x:a,b)where(a,b)=unzipEithersxsunzipEithers(Rightx:xs)=(a,x:b)where(a,b)=unzipEithersxsinitLast::[a]->([a],a)initLast[]=error"initLast, empty list []"initLast[x]=([],x)initLast(x:xs)=(x:a,b)where(a,b)=initLastxslower=maptoLowerupper=maptoUpperreadFile'x=dosrc<-readFilexlengthsrc`seq`returnsrcreadFileUtf8'::FilePath->IOStringreadFileUtf8'x=dosrc<-readFileUtf8xlengthsrc`seq`returnsrcreadFileUtf8::FilePath->IOString#if __GLASGOW_HASKELL__ < 612readFileUtf8x=readFilex#elsereadFileUtf8x=doh<-openFilexReadModehSetEncodinghutf8hGetContentsh#endifwriteFileUtf8::FilePath->String->IO()#if __GLASGOW_HASKELL__ < 612writeFileUtf8xy=writeFilexy#elsewriteFileUtf8xy=bracket(openFilexWriteMode)hClose$\h->dohSetEncodinghutf8hPutStrhy#endifltrim=dropWhileisSpacertrim=reverse.ltrim.reversetrim=ltrim.rtrimchop::([a]->(b,[a]))->[a]->[b]chop_[]=[]chopfas=b:chopfas'where(b,as')=fasfromList::a->[a]->afromListx[]=xfromListx(y:ys)=y