dataframe-parsing-2.2.0.0: Shared text/binary parsing helpers for the dataframe ecosystem.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Schema

Description

The runtime schema surface for the dataframe ecosystem: the Schema tag, its element types, and builders to describe a frame's columns by name. Re-exported so callers never reach into DataFrame.Internal.Schema.

Synopsis

Documentation

newtype Schema Source #

Logical schema of a DataFrame: a mapping from column names to their element types (SchemaType).

Constructors

Schema 

Fields

  • elements :: Map Text SchemaType

    Mapping from column name to its SchemaType.

    Invariant: keys are unique column names. A missing key means the column is not present in the schema.

Instances

Instances details
Show Schema Source # 
Instance details

Defined in DataFrame.Internal.Schema

Eq Schema Source # 
Instance details

Defined in DataFrame.Internal.Schema

Methods

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

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

data SchemaType where Source #

A runtime tag for a column’s element type.

Constructors

SType :: forall a. (Columnable a, Read a) => Proxy a -> SchemaType

Constructor carrying a Proxy of the element type.

Instances

Instances details
Show SchemaType Source #

Show the underlying element type using typeRep.

Examples

Expand
>>> :set -XTypeApplications
>>> show (schemaType @Bool)
"Bool"
Instance details

Defined in DataFrame.Internal.Schema

Eq SchemaType Source #

Two SchemaTypes are equal iff their element types are the same.

Examples

Expand
>>> :set -XTypeApplications
>>> schemaType @Int == schemaType @Int
True
>>> schemaType @Int == schemaType @Integer
False
Instance details

Defined in DataFrame.Internal.Schema

schemaType :: (Columnable a, Read a) => SchemaType Source #

Construct a SchemaType for the given a.

Examples

Expand
>>> :set -XTypeApplications
>>> schemaType @T.Text == schemaType @T.Text
True
>>> show (schemaType @Double)
"Double"

makeSchema :: [(Text, SchemaType)] -> Schema Source #

Construct a Schema from a list of (columnName, schemaType) pairs.

class RuntimeSchema (cols :: [(Symbol, Type)]) where Source #

The runtime Schema behind a type-level schema — names and element types — so a reader can project to a schema's columns and skip inference for them in one step.

Every column type must have a Read instance, which Columnable does not imply; that is what lets the names carry their types across to a reader.

Examples

Expand
>>> :set -XTypeApplications -XDataKinds
>>> elements (runtimeSchema @'[ '("n", Int)])
fromList [("n",Int)]

Instances

Instances details
RuntimeSchema ('[] :: [(Symbol, Type)]) Source # 
Instance details

Defined in DataFrame.Internal.Schema

(KnownSymbol name, Columnable a, Read a, RuntimeSchema rest) => RuntimeSchema ('(name, a) ': rest) Source # 
Instance details

Defined in DataFrame.Internal.Schema