foundation-0.0.25: Alternative prelude with batteries and no dependencies

LicenseBSD-style
MaintainerFoundation
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foundation.Format.CSV

Contents

Description

Provies the support for Comma Separated Value

Synopsis

CSV

data CSV Source #

CSV Type

Instances
IsList CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Associated Types

type Item CSV :: Type #

Methods

fromList :: [Item CSV] -> CSV #

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

toList :: CSV -> [Item CSV] #

Eq CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

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

Show CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

showsPrec :: Int -> CSV -> ShowS #

show :: CSV -> String #

showList :: [CSV] -> ShowS #

Semigroup CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

sconcat :: NonEmpty CSV -> CSV #

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

Monoid CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

mempty :: CSV #

mappend :: CSV -> CSV -> CSV #

mconcat :: [CSV] -> CSV #

NormalForm CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toNormalForm :: CSV -> () #

Collection CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IndexedCollection CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Sequential CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

reverse :: CSV -> CSV Source #

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

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

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

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

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

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

singleton :: Element CSV -> CSV Source #

head :: NonEmpty CSV -> Element CSV Source #

last :: NonEmpty CSV -> Element CSV Source #

tail :: NonEmpty CSV -> CSV Source #

init :: NonEmpty CSV -> CSV Source #

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

isPrefixOf :: CSV -> CSV -> Bool Source #

isSuffixOf :: CSV -> CSV -> Bool Source #

isInfixOf :: CSV -> CSV -> Bool Source #

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

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

type Item CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

type Item CSV = Row
type Element CSV Source # 
Instance details

Defined in Foundation.Format.CSV.Types

type Element CSV = Row

Builder

String Bulider

csvStringBuilder :: CSV -> Builder Source #

serialise the CSV document into a UTF8 string

Block Builder

csvBlockBuilder :: CSV -> Builder Source #

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

Conduit

rowC :: (Record row, Monad m) => Conduit row (Block Word8) m () Source #

Parser

String Bulider

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

Conduit

Row

data Row Source #

CSV Row

Instances
IsList Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Associated Types

type Item Row :: Type #

Methods

fromList :: [Item Row] -> Row #

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

toList :: Row -> [Item Row] #

Eq Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

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

Show Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

showsPrec :: Int -> Row -> ShowS #

show :: Row -> String #

showList :: [Row] -> ShowS #

Semigroup Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

sconcat :: NonEmpty Row -> Row #

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

Monoid Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

mempty :: Row #

mappend :: Row -> Row -> Row #

mconcat :: [Row] -> Row #

NormalForm Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toNormalForm :: Row -> () #

Collection Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IndexedCollection Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Sequential Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

reverse :: Row -> Row Source #

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

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

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

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

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

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

singleton :: Element Row -> Row Source #

head :: NonEmpty Row -> Element Row Source #

last :: NonEmpty Row -> Element Row Source #

tail :: NonEmpty Row -> Row Source #

init :: NonEmpty Row -> Row Source #

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

isPrefixOf :: Row -> Row -> Bool Source #

isSuffixOf :: Row -> Row -> Bool Source #

isInfixOf :: Row -> Row -> Bool Source #

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

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

Record Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

type Item Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

type Item Row = Field
type Element Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

class Record a where Source #

Methods

toRow :: a -> Row Source #

fromRow :: Row -> Either String a Source #

Instances
Record Row Source # 
Instance details

Defined in Foundation.Format.CSV.Types

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

Defined in Foundation.Format.CSV.Types

Methods

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

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

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

Defined in Foundation.Format.CSV.Types

Methods

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

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

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

Defined in Foundation.Format.CSV.Types

Methods

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

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

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

Defined in Foundation.Format.CSV.Types

Methods

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

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

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

Defined in Foundation.Format.CSV.Types

Methods

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

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

Field

data Field Source #

CSV field

Instances
Eq Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

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

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

Show Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

showsPrec :: Int -> Field -> ShowS #

show :: Field -> String #

showList :: [Field] -> ShowS #

NormalForm Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

Methods

toNormalForm :: Field -> () #

Arbitrary Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

class IsField a where Source #

Instances
IsField Bool Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Char Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Double Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int8 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int16 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int32 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Int64 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Integer Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Natural Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word8 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word16 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word32 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word64 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField String Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word256 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Word128 Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField Field Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField [Char] Source # 
Instance details

Defined in Foundation.Format.CSV.Types

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

Defined in Foundation.Format.CSV.Types

IsField (Offset a) Source # 
Instance details

Defined in Foundation.Format.CSV.Types

IsField (CountOf a) Source # 
Instance details

Defined in Foundation.Format.CSV.Types

helpers

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

helper function to create a FieldInteger

string :: String -> Field Source #

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