classy-prelude-0.5.1: A typeclass-based Prelude.

Safe HaskellNone

ClassyPrelude

Contents

Synopsis

CorePrelude

Standard

Monoid

append :: Monoid m => m -> m -> mSource

(++) :: Monoid m => m -> m -> mSource

Monad

Mutable references

Non-standard

List-like classes

map :: CanMap ci co i o => (i -> o) -> ci -> coSource

concat :: CanConcat c i => c -> iSource

concatMap :: CanConcatMap ci co i o => (i -> o) -> ci -> coSource

filter :: CanFilter c i => (i -> Bool) -> c -> cSource

find :: CanFind c i => (i -> Bool) -> c -> Maybe iSource

length :: CanLength c len => c -> lenSource

singleton :: CanSingleton c i => i -> cSource

null :: CanNull c => c -> BoolSource

pack :: CanPack c i => [i] -> cSource

unpack :: CanPack c i => c -> [i]Source

repack :: (CanPack a i, CanPack b i) => a -> bSource

Repack from one type to another, dropping to a list in the middle.

repack = pack . unpack.

fromList :: CanPack c i => [i] -> cSource

toList :: CanPack c i => c -> [i]Source

mapM :: CanMapM ci mco m i o => (i -> m o) -> ci -> mcoSource

mapM_ :: (CanMapM_ ci i, Monad m) => (i -> m o) -> ci -> m ()Source

forM :: CanMapM ci mco m i o => ci -> (i -> m o) -> mcoSource

forM_ :: (Monad m, CanMapM_ ci i) => ci -> (i -> m o) -> m ()Source

replicateM :: (CanReplicateM c i len, Monad m) => len -> m i -> m cSource

break :: CanBreak c i => (i -> Bool) -> c -> (c, c)Source

span :: CanBreak c i => (i -> Bool) -> c -> (c, c)Source

dropWhile :: CanBreak c i => (i -> Bool) -> c -> cSource

takeWhile :: CanBreak c i => (i -> Bool) -> c -> cSource

any :: CanAny c i => (i -> Bool) -> c -> BoolSource

all :: CanAny c i => (i -> Bool) -> c -> BoolSource

splitAt :: CanSplitAt c i => i -> c -> (c, c)Source

take :: CanSplitAt c i => i -> c -> cSource

drop :: CanSplitAt c i => i -> c -> cSource

fold :: CanFold c i accum => (accum -> i -> accum) -> accum -> c -> accumSource

Strict left fold.

words :: CanWords t => t -> [t]Source

unwords :: CanWords t => [t] -> tSource

lines :: CanLines t => t -> [t]Source

unlines :: CanUnlines t => [t] -> tSource

split :: CanSplit c i => (i -> Bool) -> c -> [c]Source

reverse :: CanReverse a => a -> aSource

readMay :: (Read b, CanPack a Char) => a -> Maybe bSource

replicate :: CanReplicate a i len => len -> i -> aSource

intercalate :: (CanConcat c i, CanIntersperse c i) => i -> c -> iSource

intersperse :: CanIntersperse c i => i -> c -> cSource

encodeUtf8 :: CanEncodeUtf8 ci co => ci -> coSource

decodeUtf8 :: CanDecodeUtf8 ci co => ci -> coSource

subsequences :: CanPack c i => c -> [c]Source

permutations :: CanPack c i => c -> [c]Source

partition :: CanPartition c i => (i -> Bool) -> c -> (c, c)Source

nub :: (CanNubBy c i, Ord i, CanNubBy c i) => c -> cSource

nubBy :: CanNubBy c i => (i -> i -> Bool) -> c -> cSource

sort :: CanSortBy c a => c a -> c aSource

sortBy :: CanSortBy c a => (a -> a -> Ordering) -> c a -> c aSource

sortWith :: (CanSortBy c a, Ord b) => (a -> b) -> c a -> c aSource

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.

cons :: CanCons c a => a -> c -> cSource

uncons :: CanUncons c a => c -> Maybe (a, c)Source

compareLength :: (CanCompareLength c, Integral l) => c -> l -> OrderingSource

This is a more effective alternative to statements like i >= length xs for types having an O(n) complexity of length operation like list or Text. It does not traverse the whole data structure if the value being compared to is lesser.

Map-like

lookup :: CanLookup c k v => k -> c -> Maybe vSource

Set-like

member :: CanMember c k => k -> c -> BoolSource

notMember :: CanMember c k => k -> c -> BoolSource

elem :: CanMember c k => k -> c -> BoolSource

An alias for member

notElem :: CanMember c k => k -> c -> BoolSource

An alias for notMember

union :: CanUnion c => c -> c -> cSource

difference :: CanDifference c => c -> c -> cSource

(\\) :: CanDifference c => c -> c -> cSource

An alias for difference.

intersect :: CanIntersection c => c -> c -> cSource

An alias for intersection.

unions :: (Foldable cc, Monoid c, CanUnion c) => cc c -> cSource

Text-like

show :: (Show a, CanPack c Char) => a -> cSource

toLower :: CanToLower a => a -> aSource

toUpper :: CanToUpper a => a -> aSource

toStrict :: CanToStrict a b => a -> bSource

fromStrict :: CanToStrict a b => b -> aSource

IO

writeFile :: (CanWriteFile a, MonadIO m) => FilePath -> a -> m ()Source

print :: (Show a, MonadIO m) => a -> m ()Source

Chunking

toChunks :: CanToChunks c i => c -> [i]Source

fromChunks :: CanToChunks c i => [i] -> cSource

Force types

Helper functions for situations where type inferer gets confused.

asList :: [a] -> [a]Source

asMap :: Map k v -> Map k vSource

asSet :: Set a -> Set aSource