{-# LANGUAGE NoImplicitPrelude #-}{-# LANGUAGE FunctionalDependencies #-}{-# LANGUAGE FlexibleInstances #-}{-# LANGUAGE FlexibleContexts #-}{-# LANGUAGE TypeFamilies #-}moduleClassyPrelude(-- * CorePreludemoduleCorePrelude,Seq,undefined-- * Standard-- ** Monoid,empty,append,(++)-- ** Monad,moduleControl.Monad-- ** Mutable references,moduleControl.Concurrent.MVar.Lifted,moduleData.IORef.Lifted-- * Non-standard-- ** List-like classes,map,concat,concatMap,filter,find,length,singleton,null,pack,unpack,repack,fromList,toList,mapM,mapM_,forM,forM_,replicateM,replicateM_,stripPrefix,isPrefixOf,stripSuffix,isSuffixOf,isInfixOf,break,span,dropWhile,takeWhile,any,all,splitAt,take,drop,fold,words,unwords,lines,unlines,split,reverse,readMay,replicate,intercalate,intersperse,encodeUtf8,decodeUtf8,subsequences,permutations,partition,zip,zip3,zip4,zip5,zip6,zip7,unzip,unzip3,unzip4,unzip5,unzip6,unzip7,zipWith,zipWith3,zipWith4,zipWith5,zipWith6,zipWith7,nub,nubBy,sort,sortBy,sortWith,group,groupBy,groupWith,cons,uncons,compareLength,Foldable.sum,Foldable.product,repeat-- ** Map-like,lookup,insert,delete-- ** Set-like,member,notMember,elem,notElem,union,difference,(\\),intersection,intersect,unions-- ** Text-like,show,toLower,toUpper,toCaseFold,toStrict,fromStrict-- ** IO,readFile,writeFile,getLine,print-- ** Chunking,toChunks,fromChunks-- ** Exceptions,catchAny,handleAny,tryAny,catchIO,handleIO,tryIO-- ** Force types-- | Helper functions for situations where type inferer gets confused.,asByteString,asLByteString,asHashMap,asHashSet,asText,asLText,asList,asMap,asMaybe,asSet,asVector,asIOException,asSomeException)whereimportqualifiedPreludeimportControl.Monad(when,unless,void,liftM,ap,forever,join,sequence,sequence_)importControl.Monad.Trans.Control(MonadBaseControl)importControl.Concurrent.MVar.LiftedimportData.IORef.LiftedimportData.Monoid(Monoid)importqualifiedData.MonoidasMonoidimportData.Foldable(Foldable)importqualifiedData.FoldableasFoldableimportCorePreludehiding(print,undefined)importClassyPrelude.ClassesimportClassyPrelude.ByteString()importClassyPrelude.Char()importClassyPrelude.Classes()importClassyPrelude.FilePath()importClassyPrelude.HashMap()importClassyPrelude.HashSet()importClassyPrelude.LByteString()importClassyPrelude.LText()importClassyPrelude.List()importClassyPrelude.Map()importClassyPrelude.Maybe()importClassyPrelude.Set()importClassyPrelude.Text()importClassyPrelude.Vector()importClassyPrelude.Sequence(Seq)show::(Showa,CanPackcChar)=>a->cshow=pack.Prelude.showfromList::CanPackci=>[i]->cfromList=packtoList::CanPackci=>c->[i]toList=unpackreadMay::(Readb,CanPackaChar)=>a->MaybebreadMaya=case[x|(x,t)<-Prelude.reads(unpacka),nullt]of[x]->Justx_->Nothing-- | Repack from one type to another, dropping to a list in the middle.---- @repack = pack . unpack@.repack::(CanPackai,CanPackbi)=>a->brepack=pack.unpackappend::Monoidm=>m->m->mappend=mappend{-# INLINE append #-}infixr5++(++)::Monoidm=>m->m->m(++)=mappend{-# INLINE (++) #-}infixl9\\{-This comment teaches CPP correct behaviour -}-- | An alias for `difference`.(\\)::CanDifferencec=>c->c->c(\\)=difference{-# INLINE (\\) #-}-- | An alias for `intersection`.intersect::CanIntersectionc=>c->c->cintersect=intersection{-# INLINE intersect #-}unions::(Foldablecc,Monoidc,CanUnionc)=>ccc->cunions=Foldable.foldl'unionMonoid.memptyintercalate::(CanConcatci,CanIntersperseci)=>i->c->iintercalatexsxss=concat(interspersexsxss)asByteString::ByteString->ByteStringasByteString=idasLByteString::LByteString->LByteStringasLByteString=idasHashMap::HashMapkv->HashMapkvasHashMap=idasHashSet::HashSeta->HashSetaasHashSet=idasText::Text->TextasText=idasLText::LText->LTextasLText=idasList::[a]->[a]asList=idasMap::Mapkv->MapkvasMap=idasMaybe::Maybea->MaybeaasMaybe=idasSet::Seta->SetaasSet=idasVector::Vectora->VectoraasVector=idforM::CanMapMcimcomio=>ci->(i->mo)->mcoforM=flipmapMforM_::(Monadm,CanMapM_cii)=>ci->(i->mo)->m()forM_=flipmapM_-- | An alias for 'member'elem::CanMemberck=>k->c->Boolelem=member-- | An alias for 'notMember'notElem::CanMemberck=>k->c->BoolnotElem=notMemberprint::(Showa,MonadIOm)=>a->m()print=liftIO.Prelude.printtake::CanSplitAtci=>i->c->ctakeic=Prelude.fst(splitAtic)drop::CanSplitAtci=>i->c->cdropic=Prelude.snd(splitAtic)-- | Sort elements using the user supplied function to project something out of-- each element.-- Inspired by <http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Exts.html#v:sortWith>.sortWith::(CanSortByca,Ordb)=>(a->b)->c->csortWithf=sortBy$comparingf-- | The 'groupWith' function uses the user supplied function which-- projects an element out of every list element in order to first sort the-- input list and then to form groups by equality on these projected elements---- Inspired by <http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Exts.html#v:groupWith>groupWith::(CanGroupByca,Eqb)=>(a->b)->c->[c]groupWithf=groupBy(\ab->fa==fb)-- | We define our own @undefined@ which is marked as deprecated. This makes it-- useful to use during development, but let's you more easily getting-- notification if you accidentally ship partial code in production.---- The classy prelude recommendation for when you need to really have a partial-- function in production is to use @error@ with a very descriptive message so-- that, in case an exception is thrown, you get more information than-- @Prelude.undefined@.---- Since 0.5.5undefined::aundefined=error"ClassyPrelude.undefined"{-# DEPRECATED undefined "It is highly recommended that you either avoid partial functions or provide meaningful error messages" #-}-- | A version of 'catch' which is specialized for any exception. This-- simplifies usage as no explicit type signatures are necessary.---- Since 0.5.6catchAny::MonadBaseControlIOm=>ma->(SomeException->ma)->macatchAny=catch-- | A version of 'handle' which is specialized for any exception. This-- simplifies usage as no explicit type signatures are necessary.---- Since 0.5.6handleAny::MonadBaseControlIOm=>(SomeException->ma)->ma->mahandleAny=handle-- | A version of 'try' which is specialized for any exception.-- This simplifies usage as no explicit type signatures are necessary.---- Since 0.5.6tryAny::MonadBaseControlIOm=>ma->m(EitherSomeExceptiona)tryAny=try-- | A version of 'catch' which is specialized for IO exceptions. This-- simplifies usage as no explicit type signatures are necessary.---- Since 0.5.6catchIO::MonadBaseControlIOm=>ma->(IOException->ma)->macatchIO=catch-- | A version of 'handle' which is specialized for IO exceptions. This-- simplifies usage as no explicit type signatures are necessary.---- Since 0.5.6handleIO::MonadBaseControlIOm=>(IOException->ma)->ma->mahandleIO=handle-- | A version of 'try' which is specialized for IO exceptions.-- This simplifies usage as no explicit type signatures are necessary.---- Since 0.5.6tryIO::MonadBaseControlIOm=>ma->m(EitherIOExceptiona)tryIO=try-- |---- Since 0.5.6asSomeException::SomeException->SomeExceptionasSomeException=id-- |---- Since 0.5.6asIOException::IOException->IOExceptionasIOException=id