foundation-0.0.30: Alternative prelude with batteries and no dependencies
LicenseBSD-style
MaintainerFoundation
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foundation.Format.CSV

Description

Provies the support for Comma Separated Value

Synopsis

CSV

data CSV #

CSV Type

Instances

Instances details
Monoid CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

mempty :: CSV #

mappend :: CSV -> CSV -> CSV #

mconcat :: [CSV] -> CSV #

Semigroup CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

(<>) :: CSV -> CSV -> CSV #

sconcat :: NonEmpty CSV -> CSV #

stimes :: Integral b => b -> CSV -> CSV #

IsList CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Associated Types

type Item CSV 
Instance details

Defined in Foundation.Format.CSV.Types

type Item CSV = Row

Methods

fromList :: [Item CSV] -> CSV #

fromListN :: Int -> [Item CSV] -> CSV #

toList :: CSV -> [Item CSV] #

Show CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

showsPrec :: Int -> CSV -> ShowS #

show :: CSV -> String #

showList :: [CSV] -> ShowS #

NormalForm CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toNormalForm :: CSV -> () #

Collection CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

null :: CSV -> Bool #

length :: CSV -> CountOf (Element CSV) #

elem :: (Eq a, a ~ Element CSV) => Element CSV -> CSV -> Bool #

notElem :: (Eq a, a ~ Element CSV) => Element CSV -> CSV -> Bool #

maximum :: (Ord a, a ~ Element CSV) => NonEmpty CSV -> Element CSV #

minimum :: (Ord a, a ~ Element CSV) => NonEmpty CSV -> Element CSV #

any :: (Element CSV -> Bool) -> CSV -> Bool #

all :: (Element CSV -> Bool) -> CSV -> Bool #

IndexedCollection CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Sequential CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

take :: CountOf (Element CSV) -> CSV -> CSV #

revTake :: CountOf (Element CSV) -> CSV -> CSV #

drop :: CountOf (Element CSV) -> CSV -> CSV #

revDrop :: CountOf (Element CSV) -> CSV -> CSV #

splitAt :: CountOf (Element CSV) -> CSV -> (CSV, CSV) #

revSplitAt :: CountOf (Element CSV) -> CSV -> (CSV, CSV) #

splitOn :: (Element CSV -> Bool) -> CSV -> [CSV] #

break :: (Element CSV -> Bool) -> CSV -> (CSV, CSV) #

breakEnd :: (Element CSV -> Bool) -> CSV -> (CSV, CSV) #

breakElem :: Element CSV -> CSV -> (CSV, CSV) #

takeWhile :: (Element CSV -> Bool) -> CSV -> CSV #

dropWhile :: (Element CSV -> Bool) -> CSV -> CSV #

intersperse :: Element CSV -> CSV -> CSV #

intercalate :: Element CSV -> CSV -> Element CSV #

span :: (Element CSV -> Bool) -> CSV -> (CSV, CSV) #

spanEnd :: (Element CSV -> Bool) -> CSV -> (CSV, CSV) #

filter :: (Element CSV -> Bool) -> CSV -> CSV #

partition :: (Element CSV -> Bool) -> CSV -> (CSV, CSV) #

reverse :: CSV -> CSV #

uncons :: CSV -> Maybe (Element CSV, CSV) #

unsnoc :: CSV -> Maybe (CSV, Element CSV) #

snoc :: CSV -> Element CSV -> CSV #

cons :: Element CSV -> CSV -> CSV #

find :: (Element CSV -> Bool) -> CSV -> Maybe (Element CSV) #

sortBy :: (Element CSV -> Element CSV -> Ordering) -> CSV -> CSV #

singleton :: Element CSV -> CSV #

head :: NonEmpty CSV -> Element CSV #

last :: NonEmpty CSV -> Element CSV #

tail :: NonEmpty CSV -> CSV #

init :: NonEmpty CSV -> CSV #

replicate :: CountOf (Element CSV) -> Element CSV -> CSV #

isPrefixOf :: CSV -> CSV -> Bool #

isSuffixOf :: CSV -> CSV -> Bool #

isInfixOf :: CSV -> CSV -> Bool #

stripPrefix :: CSV -> CSV -> Maybe CSV #

stripSuffix :: CSV -> CSV -> Maybe CSV #

Eq CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

(==) :: CSV -> CSV -> Bool #

(/=) :: CSV -> CSV -> Bool #

type Item CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

type Item CSV = Row
type Element CSV # 
Instance details

Defined in Foundation.Format.CSV.Types

type Element CSV = Row

Builder

String Bulider

csvStringBuilder :: CSV -> Builder #

serialise the CSV document into a UTF8 string

Block Builder

csvBlockBuilder :: CSV -> Builder #

serialise the CSV document into a UTF8 encoded (Block Word8)

Conduit

rowC :: forall row (m :: Type -> Type). (Record row, Monad m) => Conduit row (Block Word8) m () #

Parser

String Bulider

record_ :: (Typeable row, Record row) => Parser String row #

Conduit

recordC :: forall (m :: Type -> Type). (Monad m, MonadThrow m) => Conduit String Row m () #

Row

data Row #

CSV Row

Instances

Instances details
Monoid Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

mempty :: Row #

mappend :: Row -> Row -> Row #

mconcat :: [Row] -> Row #

Semigroup Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

(<>) :: Row -> Row -> Row #

sconcat :: NonEmpty Row -> Row #

stimes :: Integral b => b -> Row -> Row #

IsList Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Associated Types

type Item Row 
Instance details

Defined in Foundation.Format.CSV.Types

type Item Row = Field

Methods

fromList :: [Item Row] -> Row #

fromListN :: Int -> [Item Row] -> Row #

toList :: Row -> [Item Row] #

Show Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

showsPrec :: Int -> Row -> ShowS #

show :: Row -> String #

showList :: [Row] -> ShowS #

NormalForm Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toNormalForm :: Row -> () #

Collection Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

null :: Row -> Bool #

length :: Row -> CountOf (Element Row) #

elem :: (Eq a, a ~ Element Row) => Element Row -> Row -> Bool #

notElem :: (Eq a, a ~ Element Row) => Element Row -> Row -> Bool #

maximum :: (Ord a, a ~ Element Row) => NonEmpty Row -> Element Row #

minimum :: (Ord a, a ~ Element Row) => NonEmpty Row -> Element Row #

any :: (Element Row -> Bool) -> Row -> Bool #

all :: (Element Row -> Bool) -> Row -> Bool #

IndexedCollection Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Sequential Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

take :: CountOf (Element Row) -> Row -> Row #

revTake :: CountOf (Element Row) -> Row -> Row #

drop :: CountOf (Element Row) -> Row -> Row #

revDrop :: CountOf (Element Row) -> Row -> Row #

splitAt :: CountOf (Element Row) -> Row -> (Row, Row) #

revSplitAt :: CountOf (Element Row) -> Row -> (Row, Row) #

splitOn :: (Element Row -> Bool) -> Row -> [Row] #

break :: (Element Row -> Bool) -> Row -> (Row, Row) #

breakEnd :: (Element Row -> Bool) -> Row -> (Row, Row) #

breakElem :: Element Row -> Row -> (Row, Row) #

takeWhile :: (Element Row -> Bool) -> Row -> Row #

dropWhile :: (Element Row -> Bool) -> Row -> Row #

intersperse :: Element Row -> Row -> Row #

intercalate :: Element Row -> Row -> Element Row #

span :: (Element Row -> Bool) -> Row -> (Row, Row) #

spanEnd :: (Element Row -> Bool) -> Row -> (Row, Row) #

filter :: (Element Row -> Bool) -> Row -> Row #

partition :: (Element Row -> Bool) -> Row -> (Row, Row) #

reverse :: Row -> Row #

uncons :: Row -> Maybe (Element Row, Row) #

unsnoc :: Row -> Maybe (Row, Element Row) #

snoc :: Row -> Element Row -> Row #

cons :: Element Row -> Row -> Row #

find :: (Element Row -> Bool) -> Row -> Maybe (Element Row) #

sortBy :: (Element Row -> Element Row -> Ordering) -> Row -> Row #

singleton :: Element Row -> Row #

head :: NonEmpty Row -> Element Row #

last :: NonEmpty Row -> Element Row #

tail :: NonEmpty Row -> Row #

init :: NonEmpty Row -> Row #

replicate :: CountOf (Element Row) -> Element Row -> Row #

isPrefixOf :: Row -> Row -> Bool #

isSuffixOf :: Row -> Row -> Bool #

isInfixOf :: Row -> Row -> Bool #

stripPrefix :: Row -> Row -> Maybe Row #

stripSuffix :: Row -> Row -> Maybe Row #

Record Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: Row -> Row #

fromRow :: Row -> Either String Row #

Eq Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

(==) :: Row -> Row -> Bool #

(/=) :: Row -> Row -> Bool #

type Item Row # 
Instance details

Defined in Foundation.Format.CSV.Types

type Item Row = Field
type Element Row # 
Instance details

Defined in Foundation.Format.CSV.Types

class Record a where #

Methods

toRow :: a -> Row #

fromRow :: Row -> Either String a #

Instances

Instances details
Record Row # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: Row -> Row #

fromRow :: Row -> Either String Row #

(IsField a, IsField b) => Record (a, b) # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: (a, b) -> Row #

fromRow :: Row -> Either String (a, b) #

(IsField a, IsField b, IsField c) => Record (a, b, c) # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: (a, b, c) -> Row #

fromRow :: Row -> Either String (a, b, c) #

(IsField a, IsField b, IsField c, IsField d) => Record (a, b, c, d) # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: (a, b, c, d) -> Row #

fromRow :: Row -> Either String (a, b, c, d) #

(IsField a, IsField b, IsField c, IsField d, IsField e) => Record (a, b, c, d, e) # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: (a, b, c, d, e) -> Row #

fromRow :: Row -> Either String (a, b, c, d, e) #

(IsField a, IsField b, IsField c, IsField d, IsField e, IsField f) => Record (a, b, c, d, e, f) # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toRow :: (a, b, c, d, e, f) -> Row #

fromRow :: Row -> Either String (a, b, c, d, e, f) #

Field

data Field #

CSV field

Instances

Instances details
Show Field # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

showsPrec :: Int -> Field -> ShowS #

show :: Field -> String #

showList :: [Field] -> ShowS #

NormalForm Field # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toNormalForm :: Field -> () #

Arbitrary Field # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

arbitrary :: Gen Field #

IsField Field # 
Instance details

Defined in Foundation.Format.CSV.Types

Eq Field # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

(==) :: Field -> Field -> Bool #

(/=) :: Field -> Field -> Bool #

class IsField a where #

Methods

toField :: a -> Field #

fromField :: Field -> Either String a #

Instances

Instances details
IsField Int16 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int32 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int64 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int8 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word16 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word32 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word64 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word8 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word128 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word256 # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField String # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Field # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Integer # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Natural # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Bool # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Char # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Double # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField (CountOf a) # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField (Offset a) # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField a => IsField (Maybe a) # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField [Char] # 
Instance details

Defined in Foundation.Format.CSV.Types

helpers

integral :: Into Integer a => a -> Field #

helper function to create a FieldInteger

string :: String -> Field #

heler function to create a FieldString.

This function will findout automatically if an escaping is needed. if you wish to perform the escaping manually, do not used this function