Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype Encoding f c a = Encoding {
- getEncoding :: Vector (OneEncoding f c a)
- data Decoding f content a where
- DecodingPure :: !a -> Decoding f content a
- DecodingAp :: !(f content) -> !(content -> Either String a) -> !(Decoding f content (a -> b)) -> Decoding f content b
- data OneEncoding f content a = OneEncoding {
- oneEncodingHead :: !(f content)
- oneEncodingEncode :: !(a -> content)
- newtype Headed a = Headed {
- getHeaded :: a
- data Headless a = Headless
- data Indexed f a = Indexed {
- indexedIndex :: !Int
- indexedHeading :: !(f a)
- data HeadingErrors content = HeadingErrors {
- headingErrorsMissing :: Vector content
- headingErrorsDuplicate :: Vector (content, Int)
- data DecodingCellError f content = DecodingCellError {
- decodingCellErrorContent :: !content
- decodingCellErrorHeader :: !(Indexed f content)
- decodingCellErrorMessage :: !String
- data DecodingRowError f content = DecodingRowError {
- decodingRowErrorRow :: !Int
- decodingRowErrorError :: !(RowError f content)
- newtype DecodingCellErrors f content = DecodingCellErrors {
- getDecodingCellErrors :: Vector (DecodingCellError f content)
- data RowError f content
- = RowErrorParse !String
- | RowErrorDecode !(DecodingCellErrors f content)
- | RowErrorSize !Int !Int
- | RowErrorHeading !(HeadingErrors content)
- | RowErrorMinSize !Int !Int
- | RowErrorMalformed !String
Documentation
newtype Encoding f c a Source #
An columnar encoding of a
. The type variable f
determines what
is present in each column in the header row. It is typically instantiated
to Headed
and occasionally to Headless
. There is nothing that
restricts it to these two types, although they satisfy the majority
of use cases. The type variable c
is the content type. This can
be Text
, String
, or ByteString
. In the companion libraries
reflex-dom-colonnade
and yesod-colonnade
, additional types
that represent HTML with element attributes are provided that serve
as the content type.
Internally, an Encoding
is represented as a Vector
of individual
column encodings. It is possible to use any collection type with
Alternative
and Foldable
instances. However, Vector
was chosen to
optimize the data structure for the use case of building the structure
once and then folding over it many times. It is recommended that
Encoding
s are defined at the top-level so that GHC avoid reconstructing
them every time they are used.
Encoding | |
|
data Decoding f content a where Source #
This just actually a specialization of the free applicative.
Check out Control.Applicative.Free
in the free
library to
learn more about this. The meanings of the fields are documented
slightly more in the source code. Unfortunately, haddock does not
play nicely with GADTs.
DecodingPure :: !a -> Decoding f content a | |
DecodingAp :: !(f content) -> !(content -> Either String a) -> !(Decoding f content (a -> b)) -> Decoding f content b |
data OneEncoding f content a Source #
Encodes a header and a cell.
OneEncoding | |
|
Contravariant (OneEncoding f content) Source # | |
This type is isomorphic to Identity
.
This type is isomorphic to Proxy
Indexed | |
|
data HeadingErrors content Source #
HeadingErrors | |
|
data DecodingCellError f content Source #
DecodingCellError | |
|
data DecodingRowError f content Source #
DecodingRowError | |
|
newtype DecodingCellErrors f content Source #
DecodingCellErrors | |
|
data RowError f content Source #
RowErrorParse !String | Error occurred parsing the document into cells |
RowErrorDecode !(DecodingCellErrors f content) | Error decoding the content |
RowErrorSize !Int !Int | Wrong number of cells in the row |
RowErrorHeading !(HeadingErrors content) | |
RowErrorMinSize !Int !Int | |
RowErrorMalformed !String | Error decoding unicode content |