-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Data frames For working with tabular data files
--   
--   User-friendly, type safe, runtime efficient tooling for working with
--   tabular data deserialized from comma-separated values (CSV) files. The
--   type of each row of data is inferred from data, which can then be
--   streamed from disk, or worked with in memory.
@package Frames
@version 0.3.0.2


-- | Column types
module Frames.Col

-- | A column's type includes a textual name and the data type of each
--   element.
newtype (:->) (s :: Symbol) a
Col :: a -> (:->) a
[getCol] :: (:->) a -> a

-- | Used only for a show instance that parenthesizes the value.
newtype Col' s a
Col' :: (s :-> a) -> Col' s a

-- | Helper for making a <a>Col'</a>
col' :: a -> Col' s a
instance GHC.Float.Floating a => GHC.Float.Floating (s Frames.Col.:-> a)
instance GHC.Real.Fractional a => GHC.Real.Fractional (s Frames.Col.:-> a)
instance GHC.Real.RealFrac a => GHC.Real.RealFrac (s Frames.Col.:-> a)
instance GHC.Float.RealFloat a => GHC.Float.RealFloat (s Frames.Col.:-> a)
instance GHC.Real.Real a => GHC.Real.Real (s Frames.Col.:-> a)
instance GHC.Base.Monoid a => GHC.Base.Monoid (s Frames.Col.:-> a)
instance GHC.Num.Num a => GHC.Num.Num (s Frames.Col.:-> a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (s Frames.Col.:-> a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (s Frames.Col.:-> a)
instance (GHC.TypeLits.KnownSymbol s, GHC.Show.Show a) => GHC.Show.Show (Frames.Col.Col' s a)
instance (GHC.TypeLits.KnownSymbol s, GHC.Show.Show a) => GHC.Show.Show (s Frames.Col.:-> a)

module Frames.ColumnTypeable
data Parsed a
Possibly :: a -> Parsed a
Definitely :: a -> Parsed a

-- | Values that can be read from a <a>Text</a> with more or less
--   discrimination.
class Parseable a

-- | Returns <a>Nothing</a> if a value of the given type can not be read;
--   returns 'Just Possibly' if a value can be read, but is likely
--   ambiguous (e.g. an empty string); returns 'Just Definitely' if a value
--   can be read and is unlikely to be ambiguous."
parse :: (Parseable a, MonadPlus m) => Text -> m (Parsed a)

-- | Returns <a>Nothing</a> if a value of the given type can not be read;
--   returns 'Just Possibly' if a value can be read, but is likely
--   ambiguous (e.g. an empty string); returns 'Just Definitely' if a value
--   can be read and is unlikely to be ambiguous."
parse :: (Parseable a, Readable a, MonadPlus m) => Text -> m (Parsed a)

-- | Discard any estimate of a parse's ambiguity.
discardConfidence :: Parsed a -> a

-- | Acts just like <a>fromText</a>: tries to parse a value from a
--   <a>Text</a> and discards any estimate of the parse's ambiguity.
parse' :: (MonadPlus m, Parseable a) => Text -> m a

-- | This class relates a universe of possible column types to Haskell
--   types, and provides a mechanism to infer which type best represents
--   some textual data.
class ColumnTypeable a
colType :: ColumnTypeable a => a -> Q Type
inferType :: ColumnTypeable a => Text -> a
instance GHC.Show.Show a => GHC.Show.Show (Frames.ColumnTypeable.Parsed a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Frames.ColumnTypeable.Parsed a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Frames.ColumnTypeable.Parsed a)
instance Frames.ColumnTypeable.Parseable GHC.Types.Bool
instance Frames.ColumnTypeable.Parseable GHC.Types.Int
instance Frames.ColumnTypeable.Parseable GHC.Types.Float
instance Frames.ColumnTypeable.Parseable GHC.Types.Double
instance Frames.ColumnTypeable.Parseable Data.Text.Internal.Text
instance GHC.Base.Functor Frames.ColumnTypeable.Parsed


-- | Helpers for working with type-level lists.
module Frames.TypeLevel

-- | Constraint that every element of a promoted list is equal to a
--   particular type. That is, the list of types is a single type repeated
--   some number of times.

module Frames.RecF

-- | Two records may be pasted together.
rappend :: () => Rec k f as -> Rec k f bs -> Rec k f (++) k as bs

-- | A record may be traversed with respect to its interpretation functor.
--   This can be used to yank (some or all) effects from the fields of the
--   record to the outside of the record.
rtraverse :: Applicative h => (forall (x :: u). () => f x -> h g x) -> Rec u f rs -> h Rec u g rs

-- | Delete a field from a record
rdel :: CanDelete r rs => proxy r -> Rec f rs -> Rec f (RDelete r rs)

-- | A constraint that a field can be deleted from a record.
type CanDelete r rs = (RElem r rs (RIndex r rs), RDelete r rs ⊆ rs)

-- | Add a column to the head of a row.
frameCons :: Functor f => f a -> Rec f rs -> Rec f ((s :-> a) : rs)

-- | Add a pure column to the head of a row.
frameConsA :: Applicative f => a -> Rec f rs -> Rec f ((s :-> a) : rs)

-- | Add a column to the tail of a row. Note that the supplied value should
--   be a <a>Col</a> to work with the <tt>Frames</tt> tooling.
frameSnoc :: Rec f rs -> f r -> Rec f (rs ++ '[r])

-- | Enforce a constraint on the payload type of each column.
type AllCols c ts = AllConstrained c (UnColumn ts)

-- | Strip the column information from each element of a list of types.

-- | Remove the column name phantom types from a record, leaving you with
--   an unadorned Vinyl <a>Rec</a>.
class AsVinyl ts
toVinyl :: (AsVinyl ts, Functor f) => Rec f ts -> Rec f (UnColumn ts)
fromVinyl :: (AsVinyl ts, Functor f) => Rec f (UnColumn ts) -> Rec f ts

-- | Map a function across a homogeneous, monomorphic <a>Rec</a>.
mapMono :: (AllAre a (UnColumn ts), Functor f, AsVinyl ts) => (a -> a) -> Rec f ts -> Rec f ts

-- | Map a typeclass method across a <a>Rec</a> each of whose fields has an
--   instance of the typeclass.
mapMethod :: forall f c ts. (Functor f, AllConstrained c (UnColumn ts), AsVinyl ts) => Proxy c -> (forall a. c a => a -> a) -> Rec f ts -> Rec f ts

-- | N-ary version of <a>uncurry</a> over functorial frame rows. See
--   <a>runcurry</a>.
runcurry :: (Functor f, AsVinyl ts) => CurriedF f (UnColumn ts) a -> Rec f ts -> a

-- | N-ary version of <a>uncurry</a> over pure frame rows. See
--   <a>runcurry'</a>.
runcurry' :: AsVinyl ts => Curried (UnColumn ts) a -> Rec Identity ts -> a

-- | Lift an N-ary function over types in <tt>g</tt> to work over a record
--   of <a>Compose</a>d <a>Applicative</a> computations. A more general
--   version of <a>runcurryA'</a>.
runcurryA :: (Applicative f, Functor g, AsVinyl ts) => CurriedF g (UnColumn ts) a -> Rec (Compose f g) ts -> f a

-- | Lift an N-ary function to work over a row of <a>Applicative</a>
--   computations. See <a>runcurryA</a>.
runcurryA' :: (Applicative f, AsVinyl ts) => Curried (UnColumn ts) a -> Rec f ts -> f a

-- | The ability to pretty print a <tt>Rec'</tt>s fields.
class Functor f => ShowRec f rs

-- | Pretty printing of <a>Rec</a> values.
showRec :: ShowRec f rs => Rec f rs -> String

-- | A type function to convert a <tt>Record</tt> to a <a>Rec</a>.
--   <tt>ColFun f (Rec rs) = Rec f rs</tt>.
class ColumnHeaders (cs :: [*])

-- | Return the column names for a record.
columnHeaders :: ColumnHeaders cs => proxy (Rec f cs) -> [String]

-- | Return the column names for a record.
columnHeaders :: ColumnHeaders cs => proxy (Rec f cs) -> [String]

-- | Build a record whose elements are derived solely from a constraint
--   satisfied by each.
reifyDict :: forall c f proxy ts. (AllConstrained c ts, RecApplicative ts) => proxy c -> (forall a. c a => f a) -> Rec f ts
instance GHC.Base.Functor f => Frames.RecF.ShowRec f '[]
instance (GHC.TypeLits.KnownSymbol s, GHC.Show.Show (f (Frames.Col.Col' s a)), Frames.RecF.ShowRec f rs) => Frames.RecF.ShowRec f ((s Frames.Col.:-> a) : rs)
instance Frames.RecF.AsVinyl '[]
instance Frames.RecF.AsVinyl ts => Frames.RecF.AsVinyl ((s Frames.Col.:-> t) : ts)
instance Frames.RecF.ColumnHeaders '[]
instance (Frames.RecF.ColumnHeaders cs, GHC.TypeLits.KnownSymbol s) => Frames.RecF.ColumnHeaders ((s Frames.Col.:-> c) : cs)

module Frames.Rec

-- | A record with unadorned values. This is <tt>Vinyl</tt>'s <a>Rec</a>
--   <a>Identity</a>. We give this type a name as it is used pervasively
--   for records in <tt>Frames</tt>.
type Record = Rec Identity

-- | A <tt>cons</tt> function for building <a>Record</a> values.
(&:) :: a -> Record rs -> Record ((s :-> a) : rs)
infixr 5 &:

-- | Separate the first element of a <a>Record</a> from the rest of the
--   row.
recUncons :: Record ((s :-> a) : rs) -> (a, Record rs)

-- | Undistribute <a>Maybe</a> from a <a>Rec</a> <a>Maybe</a>. This is just
--   a specific usage of <a>rtraverse</a>, but it is quite common.
recMaybe :: Rec Maybe cs -> Maybe (Record cs)

-- | Show each field of a <a>Record</a> <i>without</i> its column name.
showFields :: (RecAll Identity (UnColumn ts) Show, AsVinyl ts) => Record ts -> [String]


-- | Lens utilities for working with <a>Record</a>s.
module Frames.RecLens
rlens' :: (i ~ RIndex r rs, RElem r rs i, Functor f) => sing r -> (g r -> f (g r)) -> Rec g rs -> f (Rec g rs)

-- | Getter for a <a>Rec</a> field
rget' :: Functor g => (forall f. Functor f => (g (s :-> a) -> f (g (s :-> a))) -> Rec g rs -> f (Rec g rs)) -> Rec g rs -> g a

-- | Setter for a <a>Rec</a> field.
rput' :: Functor g => (forall f. Functor f => (g (s :-> a) -> f (g (s :-> a))) -> Rec g rs -> f (Rec g rs)) -> g a -> Rec g rs -> Rec g rs

-- | Create a lens for accessing a field of a <a>Record</a>.
rlens :: (Functor f, RElem (s :-> a) rs (RIndex (s :-> a) rs)) => proxy (s :-> a) -> (a -> f a) -> Record rs -> f (Record rs)

-- | Getter for a <a>Record</a> field.
rget :: (forall f. Functor f => (a -> f a) -> Record rs -> f (Record rs)) -> Record rs -> a

-- | Setter for a <a>Record</a> field.
rput :: (forall f. Functor f => (a -> f a) -> Record rs -> f (Record rs)) -> a -> Record rs -> Record rs


-- | A <a>Frame</a> is a finite <a>Int</a>-indexed collection of rows.
module Frames.Frame

-- | A <a>Frame</a> is a finite collection of rows indexed by <a>Int</a>.
data Frame r
Frame :: !Int -> (Int -> r) -> Frame r
[frameLength] :: Frame r -> !Int
[frameRow] :: Frame r -> Int -> r

-- | A <a>Frame</a> whose rows are <a>Record</a> values.
type FrameRec rs = Frame (Record rs)

-- | Build a <a>Frame</a> from any <a>Foldable</a>. This simply uses a
--   boxed <a>Vector</a> to hold each row. If you have a collection of
--   <a>Record</a>s, consider using <a>toFrame</a>.
boxedFrame :: Foldable f => f r -> Frame r

-- | The <a>Monoid</a> instance for <a>Frame</a> provides a mechanism for
--   vertical concatenation of <a>Frame</a>s. That is, <tt>f1 &lt;&gt;
--   f2</tt> will return a new <a>Frame</a> with the rows of <tt>f1</tt>
--   followed by the rows of <tt>f2</tt>.

-- | Horizontal <a>Frame</a> concatenation. That is, <tt>zipFrames f1
--   f2</tt> will return a <a>Frame</a> with as many rows as the smaller of
--   <tt>f1</tt> and <tt>f2</tt> whose rows are the result of appending the
--   columns of <tt>f2</tt> to those of <tt>f1</tt>.
zipFrames :: FrameRec rs -> FrameRec rs' -> FrameRec (rs ++ rs')
instance GHC.Base.Functor Frames.Frame.Frame
instance GHC.Classes.Eq r => GHC.Classes.Eq (Frames.Frame.Frame r)
instance GHC.Base.Monoid (Frames.Frame.Frame r)
instance Data.Foldable.Foldable Frames.Frame.Frame
instance GHC.Base.Applicative Frames.Frame.Frame
instance GHC.Base.Monad Frames.Frame.Frame

module Frames.Melt
type ElemOf ts r = RElem r ts (RIndex r ts)
class RowToColumn ts rs
rowToColumnAux :: RowToColumn ts rs => Proxy ts -> Rec f rs -> [CoRec f ts]

-- | Transform a record into a list of its fields, retaining proof that
--   each field is part of the whole.
rowToColumn :: RowToColumn ts ts => Rec f ts -> [CoRec f ts]
meltAux :: forall vs ss ts. (vs ⊆ ts, ss ⊆ ts, Disjoint ss ts ~  'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => Record ts -> [Record (("value" :-> CoRec Identity vs) : ss)]

-- | This is <a>melt</a>, but the variables are at the front of the record,
--   which reads a bit odd.
meltRow' :: forall proxy vs ts ss. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, Disjoint ss ts ~  'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> Record ts -> [Record (("value" :-> CoRec Identity vs) : ss)]

-- | Turn a cons into a snoc after the fact.
retroSnoc :: forall t ts. Record (t : ts) -> Record (ts ++ '[t])

-- | Like <tt>melt</tt> in the <tt>reshape2</tt> package for the <tt>R</tt>
--   language. It stacks multiple columns into a single column over
--   multiple rows. Takes a specification of the id columns that remain
--   unchanged. The remaining columns will be stacked.
--   
--   Suppose we have a record, <tt>r :: Record [Name,Age,Weight]</tt>. If
--   we apply <tt>melt [pr1|Name|] r</tt>, we get two values with type
--   <tt>Record [Name, "value" :-&gt; CoRec Identity [Age,Weight]]</tt>.
--   The first will contain <tt>Age</tt> in the <tt>value</tt> column, and
--   the second will contain <tt>Weight</tt> in the <tt>value</tt> column.
meltRow :: (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, Disjoint ss ts ~  'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> Record ts -> [Record (ss ++ '["value" :-> CoRec Identity vs])]
class HasLength (ts :: [k])
hasLength :: HasLength ts => proxy ts -> Int

-- | Applies <a>meltRow</a> to each row of a <a>FrameRec</a>.
melt :: forall vs ts ss proxy. (vs ⊆ ts, ss ⊆ ts, vs ~ RDeleteAll ss ts, HasLength vs, Disjoint ss ts ~  'True, ts ≅ (vs ++ ss), ColumnHeaders vs, RowToColumn vs vs) => proxy ss -> FrameRec ts -> FrameRec (ss ++ '["value" :-> CoRec Identity vs])
instance Frames.Melt.HasLength '[]
instance forall k (t :: k) (ts :: [k]). Frames.Melt.HasLength ts => Frames.Melt.HasLength (t : ts)
instance forall k (ts :: [k]). Frames.Melt.RowToColumn ts '[]
instance forall a (r :: a) (ts :: [a]) (rs :: [a]). (r Data.Vinyl.Lens.∈ ts, Frames.Melt.RowToColumn ts rs) => Frames.Melt.RowToColumn ts (r : rs)


-- | Efficient in-memory (in-core) storage of tabular data.
module Frames.InCore

-- | The most efficient vector type for each column data type.

-- | The mutable version of <a>VectorFor</a> a particular type.
type VectorMFor a = Mutable (VectorFor a)

-- | Since we stream into the in-memory representation, we use an
--   exponential growth strategy to resize arrays as more data is read in.
--   This is the initial capacity of each column.
initialCapacity :: Int

-- | Mutable vector types for each column in a row.

-- | Immutable vector types for each column in a row.

-- | Tooling to allocate, grow, write to, freeze, and index into records of
--   vectors.
class RecVec rs
allocRec :: (RecVec rs, PrimMonad m) => proxy rs -> Int -> m (Record (VectorMs m rs))
freezeRec :: (RecVec rs, PrimMonad m) => proxy rs -> Int -> Record (VectorMs m rs) -> m (Record (Vectors rs))
growRec :: (RecVec rs, PrimMonad m) => proxy rs -> Record (VectorMs m rs) -> m (Record (VectorMs m rs))
writeRec :: (RecVec rs, PrimMonad m) => proxy rs -> Int -> Record (VectorMs m rs) -> Record rs -> m ()
indexRec :: RecVec rs => proxy rs -> Int -> Record (Vectors rs) -> Record rs
produceRec :: RecVec rs => proxy rs -> Record (Vectors rs) -> Rec ((->) Int) rs

-- | Stream a finite sequence of rows into an efficient in-memory
--   representation for further manipulation. Each column of the input
--   table will be stored optimally based on its type, making use of the
--   resulting generators a matter of indexing into a densely packed
--   representation. Returns the number of rows and a record of column
--   indexing functions. See <a>toAoS</a> to convert the result to a
--   <a>Frame</a> which provides an easier-to-use function that indexes
--   into the table in a row-major fashion.
inCoreSoA :: forall m rs. (PrimMonad m, RecVec rs) => Producer (Record rs) m () -> m (Int, Rec ((->) Int) rs)

-- | Stream a finite sequence of rows into an efficient in-memory
--   representation for further manipulation. Each column of the input
--   table will be stored optimally based on its type, making use of the
--   resulting generators a matter of indexing into a densely packed
--   representation. Returns a <a>Frame</a> that provides a function to
--   index into the table.
inCoreAoS :: (PrimMonad m, RecVec rs) => Producer (Record rs) m () -> m (FrameRec rs)

-- | Like <a>inCoreAoS</a>, but applies the provided function to the record
--   of columns before building the <a>Frame</a>.
inCoreAoS' :: (PrimMonad m, RecVec rs) => (Rec ((->) Int) rs -> Rec ((->) Int) ss) -> Producer (Record rs) m () -> m (FrameRec ss)

-- | Convert a structure-of-arrays to an array-of-structures. This can
--   simplify usage of an in-memory representation.
toAoS :: Int -> Rec ((->) Int) rs -> FrameRec rs

-- | Stream a finite sequence of rows into an efficient in-memory
--   representation for further manipulation. Each column of the input
--   table will be stored optimally based on its type, making use of the
--   resulting generator a matter of indexing into a densely packed
--   representation.
inCore :: forall m n rs. (PrimMonad m, RecVec rs, Monad n) => Producer (Record rs) m () -> m (Producer (Record rs) n ())

-- | Build a <a>Frame</a> from a collection of <a>Record</a>s using
--   efficient column-based storage.
toFrame :: (Foldable f, RecVec rs) => f (Record rs) -> Frame (Record rs)

-- | Keep only those rows of a <a>FrameRec</a> that satisfy a predicate.
filterFrame :: RecVec rs => (Record rs -> Bool) -> FrameRec rs -> FrameRec rs
instance Frames.InCore.RecVec '[]
instance (Data.Vector.Generic.Mutable.Base.MVector (Frames.InCore.VectorMFor a) a, Data.Vector.Generic.Base.Vector (Frames.InCore.VectorFor a) a, Frames.InCore.RecVec rs) => Frames.InCore.RecVec ((s Frames.Col.:-> a) : rs)

module Frames.ColumnUniverse

-- | Generalize algebraic sum types.
data CoRec k (a :: k -> *) (b :: [k]) :: forall k. () => (k -> *) -> [k] -> *

-- | A universe of common column variants. These are the default column
--   types that <tt>Frames</tt> can infer. See the <a>Tutorial</a> for an
--   example of extending the default types with your own.
type Columns = ColumnUniverse CommonColumns

-- | Define a set of variants that captures all possible column types.
type ColumnUniverse = CoRec ColInfo

-- | Common column types
type CommonColumns = [Bool, Int, Double, Text]
parsedTypeRep :: ColInfo a -> Parsed TypeRep
instance (Data.Text.Internal.Text Data.Vinyl.Lens.∈ ts) => GHC.Base.Monoid (Data.Vinyl.CoRec.CoRec Frames.ColumnUniverse.ColInfo ts)
instance (Data.Vinyl.TypeLevel.AllConstrained Frames.ColumnTypeable.Parseable ts, Data.Vinyl.TypeLevel.AllConstrained Data.Typeable.Internal.Typeable ts, Data.Vinyl.CoRec.FoldRec ts ts, Data.Vinyl.Core.RecApplicative ts, Data.Text.Internal.Text Data.Vinyl.Lens.∈ ts) => Frames.ColumnTypeable.ColumnTypeable (Data.Vinyl.CoRec.CoRec Frames.ColumnUniverse.ColInfo ts)


-- | Infer row types from comma-separated values (CSV) data and read that
--   data from files. Template Haskell is used to generate the necessary
--   types so that you can write type safe programs referring to those
--   types.
module Frames.CSV
type Separator = Text
type QuoteChar = Char
data QuotingMode

-- | No quoting enabled. The separator may not appear in values
NoQuoting :: QuotingMode

-- | Quoted values with the given quoting character. Quotes are escaped by
--   doubling them. Mostly RFC4180 compliant, except doesn't support
--   newlines in values
RFC4180Quoting :: QuoteChar -> QuotingMode
data ParserOptions
ParserOptions :: Maybe [Text] -> Separator -> QuotingMode -> ParserOptions
[headerOverride] :: ParserOptions -> Maybe [Text]
[columnSeparator] :: ParserOptions -> Separator
[quotingMode] :: ParserOptions -> QuotingMode

-- | Default <tt>ParseOptions</tt> get column names from a header line, and
--   use commas to separate columns.
defaultParser :: ParserOptions

-- | Default separator string.
defaultSep :: Separator

-- | Helper to split a <a>Text</a> on commas and strip leading and trailing
--   whitespace from each resulting chunk.
tokenizeRow :: ParserOptions -> Text -> [Text]

-- | Post processing applied to a list of tokens split by the separator
--   which should have quoted sections reassembeld
reassembleRFC4180QuotedParts :: Separator -> QuoteChar -> [Text] -> [Text]

-- | Infer column types from a prefix (up to 1000 lines) of a CSV file.
prefixInference :: (ColumnTypeable a, Monoid a, Monad m) => ParserOptions -> Parser Text m [a]

-- | Extract column names and inferred types from a CSV file.
readColHeaders :: (ColumnTypeable a, Monoid a, Monad m) => ParserOptions -> Producer Text m () -> m [(Text, a)]

-- | Parsing each component of a <tt>RecF</tt> from a list of text chunks,
--   one chunk per record component.
class ReadRec (rs :: [*])
readRec :: ReadRec rs => [Text] -> Rec Maybe rs

-- | Produce the lines of a latin1 (or ISO8859 Part 1) encoded file as
--   ’T.Text’ values. Similar to ’PT.readFileLn’ that uses the system
--   locale for decoding, but built on the ’PT.decodeIso8859_1’ decoder.
readFileLatin1Ln :: MonadSafe m => FilePath -> Producer Text m ()

-- | Read a <tt>RecF</tt> from one line of CSV.
readRow :: ReadRec rs => ParserOptions -> Text -> Rec Maybe rs

-- | Produce rows where any given entry can fail to parse.
readTableMaybeOpt :: (MonadSafe m, ReadRec rs) => ParserOptions -> FilePath -> Producer (Rec Maybe rs) m ()

-- | Stream lines of CSV data into rows of ’Rec’ values values where any
--   given entry can fail to parse.
pipeTableMaybeOpt :: (Monad m, ReadRec rs) => ParserOptions -> Pipe Text (Rec Maybe rs) m ()

-- | Produce rows where any given entry can fail to parse.
readTableMaybe :: (MonadSafe m, ReadRec rs) => FilePath -> Producer (Rec Maybe rs) m ()

-- | Stream lines of CSV data into rows of ’Rec’ values where any given
--   entry can fail to parse.
pipeTableMaybe :: (Monad m, ReadRec rs) => Pipe Text (Rec Maybe rs) m ()

-- | Returns a producer of rows for which each column was successfully
--   parsed.
readTableOpt :: forall m rs. (MonadSafe m, ReadRec rs) => ParserOptions -> FilePath -> Producer (Record rs) m ()

-- | Pipe lines of CSV text into rows for which each column was
--   successfully parsed.
pipeTableOpt :: (ReadRec rs, Monad m) => ParserOptions -> Pipe Text (Record rs) m ()

-- | Returns a producer of rows for which each column was successfully
--   parsed.
readTable :: forall m rs. (MonadSafe m, ReadRec rs) => FilePath -> Producer (Record rs) m ()

-- | Pipe lines of CSV text into rows for which each column was
--   successfully parsed.
pipeTable :: (ReadRec rs, Monad m) => Pipe Text (Record rs) m ()

-- | Generate a column type.
recDec :: [(Text, Q Type)] -> Q Type

-- | Capitalize the first letter of a <a>Text</a>.
capitalize1 :: Text -> Text

-- | Massage a column name from a CSV file into a valid Haskell type
--   identifier.
sanitizeTypeName :: Text -> Text

-- | Declare a type synonym for a column.
mkColTDec :: TypeQ -> Name -> DecQ

-- | Declare a singleton value of the given column type and lenses for
--   working with that column.
mkColPDec :: Name -> TypeQ -> Text -> DecsQ
lowerHead :: Text -> Maybe Text

-- | For each column, we declare a type synonym for its type, and a Proxy
--   value of that type.
colDec :: ColumnTypeable a => Text -> Text -> a -> DecsQ

-- | Splice for manually declaring a column of a given type. For example,
--   <tt>declareColumn "x2" ''Double</tt> will declare a type synonym
--   <tt>type X2 = "x2" :-&gt; Double</tt> and a lens <tt>x2</tt>.
declareColumn :: Text -> Name -> DecsQ

-- | Control how row and named column types are generated.
data RowGen a
RowGen :: [String] -> String -> Separator -> String -> Proxy a -> Producer Text (SafeT IO) () -> RowGen a

-- | Use these column names. If empty, expect a header row in the data file
--   to provide column names.
[columnNames] :: RowGen a -> [String]

-- | A common prefix to use for every generated declaration.
[tablePrefix] :: RowGen a -> String

-- | The string that separates the columns on a row.
[separator] :: RowGen a -> Separator

-- | The row type that enumerates all columns.
[rowTypeName] :: RowGen a -> String

-- | A type that identifies all the types that can be used to classify a
--   column. This is essentially a type-level list of types. See
--   <a>colQ</a>.
[columnUniverse] :: RowGen a -> Proxy a

-- | A producer of lines of ’T.Text’xs
[lineReader] :: RowGen a -> Producer Text (SafeT IO) ()

-- | Shorthand for a <a>Proxy</a> value of <a>ColumnUniverse</a> applied to
--   the given type list.
colQ :: Name -> Q Exp

-- | A default <a>RowGen</a>. This instructs the type inference engine to
--   get column names from the data file, use the default column separator
--   (a comma), infer column types from the default <a>Columns</a> set of
--   types, and produce a row type with name <tt>Row</tt>.
rowGen :: FilePath -> RowGen Columns

-- | Generate a type for each row of a table. This will be something like
--   <tt>Record ["x" :-&gt; a, "y" :-&gt; b, "z" :-&gt; c]</tt>.
tableType :: String -> FilePath -> DecsQ

-- | Like <a>tableType</a>, but additionally generates a type synonym for
--   each column, and a proxy value of that type. If the CSV file has
--   column names "foo", "bar", and "baz", then this will declare <tt>type
--   Foo = "foo" :-&gt; Int</tt>, for example, <tt>foo = rlens (Proxy ::
--   Proxy Foo)</tt>, and <tt>foo' = rlens' (Proxy :: Proxy Foo)</tt>.
tableTypes :: String -> FilePath -> DecsQ

-- | Inspect no more than this many lines when inferring column types.
prefixSize :: Int

-- | Generate a type for a row of a table. This will be something like
--   <tt>Record ["x" :-&gt; a, "y" :-&gt; b, "z" :-&gt; c]</tt>. Column
--   type synonyms are <i>not</i> generated (see <a>tableTypes'</a>).
tableType' :: forall a. (ColumnTypeable a, Monoid a) => RowGen a -> DecsQ

-- | Tokenize the first line of a ’P.Producer’.
colNamesP :: Monad m => ParserOptions -> Producer Text m () -> m [Text]

-- | Generate a type for a row of a table all of whose columns remain
--   unparsed <tt>Text</tt> values.
tableTypesText' :: forall a. (ColumnTypeable a, Monoid a) => RowGen a -> DecsQ

-- | Like <a>tableType'</a>, but additionally generates a type synonym for
--   each column, and a proxy value of that type. If the CSV file has
--   column names "foo", "bar", and "baz", then this will declare <tt>type
--   Foo = "foo" :-&gt; Int</tt>, for example, <tt>foo = rlens (Proxy ::
--   Proxy Foo)</tt>, and <tt>foo' = rlens' (Proxy :: Proxy Foo)</tt>.
tableTypes' :: forall a. (ColumnTypeable a, Monoid a) => RowGen a -> DecsQ

-- | <a>yield</a> a header row with column names followed by a line of text
--   for each <a>Record</a> with each field separated by a comma.
produceCSV :: forall f ts m. (ColumnHeaders ts, AsVinyl ts, Foldable f, Monad m, RecAll Identity (UnColumn ts) Show) => f (Record ts) -> Producer String m ()

-- | Write a header row with column names followed by a line of text for
--   each <a>Record</a> to the given file.
writeCSV :: (ColumnHeaders ts, AsVinyl ts, Foldable f, RecAll Identity (UnColumn ts) Show) => FilePath -> f (Record ts) -> IO ()
instance GHC.Show.Show Frames.CSV.ParserOptions
instance GHC.Classes.Eq Frames.CSV.ParserOptions
instance GHC.Show.Show Frames.CSV.QuotingMode
instance GHC.Classes.Eq Frames.CSV.QuotingMode
instance Frames.CSV.ReadRec '[]
instance (Frames.ColumnTypeable.Parseable t, Frames.CSV.ReadRec ts) => Frames.CSV.ReadRec ((s Frames.Col.:-> t) : ts)
instance Language.Haskell.TH.Syntax.Lift Frames.CSV.ParserOptions
instance Language.Haskell.TH.Syntax.Lift Frames.CSV.QuotingMode


-- | Functions useful for interactively exploring and experimenting with a
--   data set.
module Frames.Exploration

-- | <tt>preview src n f</tt> prints out the first <tt>n</tt> results of
--   piping <tt>src</tt> through <tt>f</tt>.
pipePreview :: (MonadIO m, Show b) => Producer a m () -> Int -> Pipe a b m () -> m ()

-- | <tt>select (Proxy::Proxy [A,B,C])</tt> extracts columns <tt>A</tt>,
--   <tt>B</tt>, and <tt>C</tt>, from a larger record. Note, this is just a
--   way of pinning down the type of a usage of <a>rcast</a>.
select :: (fs ⊆ rs) => proxy fs -> Record rs -> Record fs

-- | <tt>lenses (Proxy::Proxy [A,B,C])</tt> provides a lens onto columns
--   <tt>A</tt>, <tt>B</tt>, and <tt>C</tt>. This is just a way of pinning
--   down the type of <a>rsubset</a>.
lenses :: (fs ⊆ rs, Functor f) => proxy fs -> (Record fs -> f (Record fs)) -> Record rs -> f (Record rs)
recToList :: (AsVinyl rs, AllAre a (UnColumn rs)) => Record rs -> [a]

-- | A proxy value quasiquoter; a way of passing types as values.
--   <tt>[pr|T|]</tt> will splice an expression <tt>Proxy::Proxy T</tt>,
--   while <tt>[pr|A,B,C|]</tt> will splice in a value of <tt>Proxy ::
--   Proxy [A,B,C]</tt>. If we have a record type with <tt>Name</tt> and
--   <tt>Age</tt> among other fields, we can write <tt>select
--   </tt>[pr|Name,Age|]@ for a function that extracts those fields from a
--   larger record.
pr :: QuasiQuoter

-- | Like <a>pr</a>, but takes a single type, which is used to produce a
--   <a>Proxy</a> for a single-element list containing only that type. This
--   is useful for passing a single type to a function that wants a list of
--   types.
pr1 :: QuasiQuoter


-- | User-friendly, type safe, runtime efficient tooling for working with
--   tabular data deserialized from comma-separated values (CSV) files. The
--   type of each row of data is inferred from data, which can then be
--   streamed from disk, or worked with in memory.
module Frames

-- | Stream a finite sequence of rows into an efficient in-memory
--   representation for further manipulation. Each column of the input
--   table will be stored optimally based on its type, making use of the
--   resulting generators a matter of indexing into a densely packed
--   representation. Returns a <a>Frame</a> that provides a function to
--   index into the table.
inCoreAoS :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (FrameRec rs)

-- | Like <a>inCoreAoS</a>, but applies the provided function to the record
--   of columns before building the <a>Frame</a>.
inCoreAoS' :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => (Rec ((->) Int) rs -> Rec ((->) Int) ss) -> Producer (Record rs) (SafeT m) () -> m (FrameRec ss)

-- | Stream a finite sequence of rows into an efficient in-memory
--   representation for further manipulation. Each column of the input
--   table will be stored optimally based on its type, making use of the
--   resulting generator a matter of indexing into a densely packed
--   representation.
inCore :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs, Monad n) => Producer (Record rs) (SafeT m) () -> m (Producer (Record rs) n ())

-- | Stream a finite sequence of rows into an efficient in-memory
--   representation for further manipulation. Each column of the input
--   table will be stored optimally based on its type, making use of the
--   resulting generators a matter of indexing into a densely packed
--   representation. Returns the number of rows and a record of column
--   indexing functions. See <tt>toAoS</tt> to convert the result to a
--   <a>Frame</a> which provides an easier-to-use function that indexes
--   into the table in a row-major fashion.
inCoreSoA :: (PrimMonad m, MonadIO m, MonadMask m, RecVec rs) => Producer (Record rs) (SafeT m) () -> m (Int, Rec ((->) Int) rs)

-- | Convert a structure-of-arrays to an array-of-structures. This can
--   simplify usage of an in-memory representation.
toAoS :: Int -> Rec ((->) Int) rs -> FrameRec rs

-- | Build a <a>Frame</a> from a collection of <a>Record</a>s using
--   efficient column-based storage.
toFrame :: (Foldable f, RecVec rs) => f (Record rs) -> Frame (Record rs)

-- | Keep only those rows of a <a>FrameRec</a> that satisfy a predicate.
filterFrame :: RecVec rs => (Record rs -> Bool) -> FrameRec rs -> FrameRec rs

-- | Run a self-contained ’Pipes.Effect’ and execute the finalizers
--   associated with the ’SafeT’ transformer.
runSafeEffect :: (MonadIO m, MonadMask m) => Effect (SafeT m) r -> m r

-- | A space efficient, packed, unboxed Unicode text type.
data Text :: *
