ipynb-0.2: Data structure for working with Jupyter notebooks (ipynb).

Copyright | Copyright (C) 2019 John MacFarlane
License | BSD3
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell2010

Data.Ipynb

Description

Data structure and JSON serializers for ipynb (Jupyter notebook) format. Version 4 of the format is documented here: https://nbformat.readthedocs.io/en/latest/format_description.html.

The library supports both version 4 ('Notebook NbV4') and version 3 ('Notebook NbV3') of nbformat. Note that this is a phantom type: the `NbV3` or `NbV4` parameter only affects JSON serialization, not the data structure itself. So code that manipulates notebooks can be polymorphic, operating on `Notebook a`.

Synopsis

- data Notebook a = Notebook {
  - notebookMetadata :: JSONMeta
  - notebookFormat :: (Int, Int)
  - notebookCells :: [Cell a]
  }
- data NbV3
- data NbV4
- newtype JSONMeta = JSONMeta (Map Text Value)
- data Cell a = Cell {
  - cellType :: CellType a
  - cellId :: Maybe Text
  - cellSource :: Source
  - cellMetadata :: JSONMeta
  - cellAttachments :: Maybe MimeAttachments
  }
- newtype Source = Source {
  - unSource :: [Text]
  }
- data CellType a
  - = Markdown
  - | Heading {
    - headingLevel :: Int
    }
  - | Raw
  - | Code {
    - codeExecutionCount :: Maybe Int
    - codeOutputs :: [Output a]
    }
- data Output a
  - = Stream {
    - streamName :: Text
    - streamText :: Source
    }
  - | DisplayData {
    - displayData :: MimeBundle
    - displayMetadata :: JSONMeta
    }
  - | ExecuteResult {
    - executeCount :: Int
    - executeData :: MimeBundle
    - executeMetadata :: JSONMeta
    }
  - | Err {
    - errName :: Text
    - errValue :: Text
    - errTraceback :: [Text]
    }
- type MimeType = Text
- data MimeData
  - = BinaryData ByteString
  - | TextualData Text
  - | JsonData Value
- newtype MimeBundle = MimeBundle {
  - unMimeBundle :: Map MimeType MimeData
  }
- newtype MimeAttachments = MimeAttachments (Map Text MimeBundle)
- breakLines :: Text -> [Text]

# Documentation

data Notebook a Source #

A Jupyter notebook.

Constructors

Notebook |

Fields

- notebookMetadata :: JSONMeta
- notebookFormat :: (Int, Int)
- notebookCells :: [Cell a]

#### Instances

Instances details

FromJSON (Notebook NbV3) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Notebook NbV3) Source # parseJSONList :: Value -> Parser [Notebook NbV3] Source # omittedField :: Maybe (Notebook NbV3) Source #
FromJSON (Notebook NbV4) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Notebook NbV4) Source # parseJSONList :: Value -> Parser [Notebook NbV4] Source # omittedField :: Maybe (Notebook NbV4) Source #
ToJSON (Notebook NbV3) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Notebook NbV3 -> Value Source # toEncoding :: Notebook NbV3 -> Encoding Source # toJSONList :: [Notebook NbV3] -> Value Source # toEncodingList :: [Notebook NbV3] -> Encoding Source # omitField :: Notebook NbV3 -> Bool Source #
ToJSON (Notebook NbV4) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Notebook NbV4 -> Value Source # toEncoding :: Notebook NbV4 -> Encoding Source # toJSONList :: [Notebook NbV4] -> Value Source # toEncodingList :: [Notebook NbV4] -> Encoding Source # omitField :: Notebook NbV4 -> Bool Source #
Monoid (Notebook a) Source # |
Instance details Defined in Data.Ipynb Methods mempty :: Notebook a Source # mappend :: Notebook a -> Notebook a -> Notebook a Source # mconcat :: [Notebook a] -> Notebook a Source #
Semigroup (Notebook a) Source # |
Instance details Defined in Data.Ipynb Methods (<>) :: Notebook a -> Notebook a -> Notebook a Source # sconcat :: NonEmpty (Notebook a) -> Notebook a Source # stimes :: Integral b => b -> Notebook a -> Notebook a Source #
Generic (Notebook a) Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep (Notebook a) |

Instance details

Defined in Data.Ipynb

type Rep (Notebook a) = D1 ('MetaData "Notebook" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) (C1 ('MetaCons "Notebook" 'PrefixI 'True) (S1 ('MetaSel ('Just "notebookMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta) :*: (S1 ('MetaSel ('Just "notebookFormat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int, Int)) :*: S1 ('MetaSel ('Just "notebookCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Cell a]))))

Methods

from :: Notebook a -> Rep (Notebook a) x Source #

to :: Rep (Notebook a) x -> Notebook a Source #

Show (Notebook a) Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Notebook a -> ShowS Source # show :: Notebook a -> String Source # showList :: [Notebook a] -> ShowS Source #
Eq (Notebook a) Source # |
Instance details Defined in Data.Ipynb Methods (==) :: Notebook a -> Notebook a -> Bool Source # (/=) :: Notebook a -> Notebook a -> Bool Source #
type Rep (Notebook a) Source # |

Instance details

Defined in Data.Ipynb

type Rep (Notebook a) = D1 ('MetaData "Notebook" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) (C1 ('MetaCons "Notebook" 'PrefixI 'True) (S1 ('MetaSel ('Just "notebookMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta) :*: (S1 ('MetaSel ('Just "notebookFormat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int, Int)) :*: S1 ('MetaSel ('Just "notebookCells") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Cell a]))))

data NbV3 Source #

Indexes `Notebook` for serialization as nbformat version 3.

#### Instances

Instances details

FromJSON (Cell NbV3) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Cell NbV3) Source # parseJSONList :: Value -> Parser [Cell NbV3] Source # omittedField :: Maybe (Cell NbV3) Source #
FromJSON (Notebook NbV3) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Notebook NbV3) Source # parseJSONList :: Value -> Parser [Notebook NbV3] Source # omittedField :: Maybe (Notebook NbV3) Source #
FromJSON (Output NbV3) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Output NbV3) Source # parseJSONList :: Value -> Parser [Output NbV3] Source # omittedField :: Maybe (Output NbV3) Source #
ToJSON (Cell NbV3) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Cell NbV3 -> Value Source # toEncoding :: Cell NbV3 -> Encoding Source # toJSONList :: [Cell NbV3] -> Value Source # toEncodingList :: [Cell NbV3] -> Encoding Source # omitField :: Cell NbV3 -> Bool Source #
ToJSON (Notebook NbV3) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Notebook NbV3 -> Value Source # toEncoding :: Notebook NbV3 -> Encoding Source # toJSONList :: [Notebook NbV3] -> Value Source # toEncodingList :: [Notebook NbV3] -> Encoding Source # omitField :: Notebook NbV3 -> Bool Source #
ToJSON (Output NbV3) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Output NbV3 -> Value Source # toEncoding :: Output NbV3 -> Encoding Source # toJSONList :: [Output NbV3] -> Value Source # toEncodingList :: [Output NbV3] -> Encoding Source # omitField :: Output NbV3 -> Bool Source #

data NbV4 Source #

Indexes `Notebook` for serialization as nbformat version 4.

#### Instances

Instances details

FromJSON (Cell NbV4) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Cell NbV4) Source # parseJSONList :: Value -> Parser [Cell NbV4] Source # omittedField :: Maybe (Cell NbV4) Source #
FromJSON (Notebook NbV4) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Notebook NbV4) Source # parseJSONList :: Value -> Parser [Notebook NbV4] Source # omittedField :: Maybe (Notebook NbV4) Source #
FromJSON (Output NbV4) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Output NbV4) Source # parseJSONList :: Value -> Parser [Output NbV4] Source # omittedField :: Maybe (Output NbV4) Source #
ToJSON (Cell NbV4) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Cell NbV4 -> Value Source # toEncoding :: Cell NbV4 -> Encoding Source # toJSONList :: [Cell NbV4] -> Value Source # toEncodingList :: [Cell NbV4] -> Encoding Source # omitField :: Cell NbV4 -> Bool Source #
ToJSON (Notebook NbV4) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Notebook NbV4 -> Value Source # toEncoding :: Notebook NbV4 -> Encoding Source # toJSONList :: [Notebook NbV4] -> Value Source # toEncodingList :: [Notebook NbV4] -> Encoding Source # omitField :: Notebook NbV4 -> Bool Source #
ToJSON (Output NbV4) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Output NbV4 -> Value Source # toEncoding :: Output NbV4 -> Encoding Source # toJSONList :: [Output NbV4] -> Value Source # toEncodingList :: [Output NbV4] -> Encoding Source # omitField :: Output NbV4 -> Bool Source #

newtype JSONMeta Source #

Constructors

JSONMeta (Map Text Value) |

#### Instances

Instances details

FromJSON JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser JSONMeta Source # parseJSONList :: Value -> Parser [JSONMeta] Source # omittedField :: Maybe JSONMeta Source #
ToJSON JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: JSONMeta -> Value Source # toEncoding :: JSONMeta -> Encoding Source # toJSONList :: [JSONMeta] -> Value Source # toEncodingList :: [JSONMeta] -> Encoding Source # omitField :: JSONMeta -> Bool Source #
Monoid JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods mempty :: JSONMeta Source # mappend :: JSONMeta -> JSONMeta -> JSONMeta Source # mconcat :: [JSONMeta] -> JSONMeta Source #
Semigroup JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods (<>) :: JSONMeta -> JSONMeta -> JSONMeta Source # sconcat :: NonEmpty JSONMeta -> JSONMeta Source # stimes :: Integral b => b -> JSONMeta -> JSONMeta Source #
Generic JSONMeta Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep JSONMeta |
Instance details Defined in Data.Ipynb type Rep JSONMeta = D1 ('MetaData "JSONMeta" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "JSONMeta" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Value))))

Methods

from :: JSONMeta -> Rep JSONMeta x Source #

to :: Rep JSONMeta x -> JSONMeta Source #

Show JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> JSONMeta -> ShowS Source # show :: JSONMeta -> String Source # showList :: [JSONMeta] -> ShowS Source #
Eq JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods (==) :: JSONMeta -> JSONMeta -> Bool Source # (/=) :: JSONMeta -> JSONMeta -> Bool Source #
Ord JSONMeta Source # |
Instance details Defined in Data.Ipynb Methods compare :: JSONMeta -> JSONMeta -> Ordering Source # (<) :: JSONMeta -> JSONMeta -> Bool Source # (<=) :: JSONMeta -> JSONMeta -> Bool Source # (>) :: JSONMeta -> JSONMeta -> Bool Source # (>=) :: JSONMeta -> JSONMeta -> Bool Source # max :: JSONMeta -> JSONMeta -> JSONMeta Source # min :: JSONMeta -> JSONMeta -> JSONMeta Source #
type Rep JSONMeta Source # |
Instance details Defined in Data.Ipynb type Rep JSONMeta = D1 ('MetaData "JSONMeta" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "JSONMeta" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Value))))

data Cell a Source #

A Jupyter notebook cell.

Constructors

Cell |

Fields

- cellType :: CellType a
- cellId :: Maybe Text
- cellSource :: Source
- cellMetadata :: JSONMeta
- cellAttachments :: Maybe MimeAttachments

#### Instances

Instances details

FromJSON (Cell NbV3) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Cell NbV3) Source # parseJSONList :: Value -> Parser [Cell NbV3] Source # omittedField :: Maybe (Cell NbV3) Source #
FromJSON (Cell NbV4) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Cell NbV4) Source # parseJSONList :: Value -> Parser [Cell NbV4] Source # omittedField :: Maybe (Cell NbV4) Source #
ToJSON (Cell NbV3) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Cell NbV3 -> Value Source # toEncoding :: Cell NbV3 -> Encoding Source # toJSONList :: [Cell NbV3] -> Value Source # toEncodingList :: [Cell NbV3] -> Encoding Source # omitField :: Cell NbV3 -> Bool Source #
ToJSON (Cell NbV4) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Cell NbV4 -> Value Source # toEncoding :: Cell NbV4 -> Encoding Source # toJSONList :: [Cell NbV4] -> Value Source # toEncodingList :: [Cell NbV4] -> Encoding Source # omitField :: Cell NbV4 -> Bool Source #
Generic (Cell a) Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep (Cell a) |

Instance details

Defined in Data.Ipynb

type Rep (Cell a) = D1 ('MetaData "Cell" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) (C1 ('MetaCons "Cell" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cellType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CellType a)) :*: S1 ('MetaSel ('Just "cellId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "cellSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Source) :*: (S1 ('MetaSel ('Just "cellMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta) :*: S1 ('MetaSel ('Just "cellAttachments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe MimeAttachments))))))

Methods

from :: Cell a -> Rep (Cell a) x Source #

to :: Rep (Cell a) x -> Cell a Source #

Show (Cell a) Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Cell a -> ShowS Source # show :: Cell a -> String Source # showList :: [Cell a] -> ShowS Source #
Eq (Cell a) Source # |
Instance details Defined in Data.Ipynb Methods (==) :: Cell a -> Cell a -> Bool Source # (/=) :: Cell a -> Cell a -> Bool Source #
type Rep (Cell a) Source # |

Instance details

Defined in Data.Ipynb

type Rep (Cell a) = D1 ('MetaData "Cell" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) (C1 ('MetaCons "Cell" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cellType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (CellType a)) :*: S1 ('MetaSel ('Just "cellId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "cellSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Source) :*: (S1 ('MetaSel ('Just "cellMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta) :*: S1 ('MetaSel ('Just "cellAttachments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe MimeAttachments))))))

newtype Source Source #

A `Source` is a textual content which may be represented in JSON either as a single string or as a list of strings (which are concatenated).

Constructors

Source |

Fields

- unSource :: [Text]

#### Instances

Instances details

FromJSON Source Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser Source Source # parseJSONList :: Value -> Parser [Source] Source # omittedField :: Maybe Source Source #
ToJSON Source Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Source -> Value Source # toEncoding :: Source -> Encoding Source # toJSONList :: [Source] -> Value Source # toEncodingList :: [Source] -> Encoding Source # omitField :: Source -> Bool Source #
Monoid Source Source # |
Instance details Defined in Data.Ipynb Methods mempty :: Source Source # mappend :: Source -> Source -> Source Source # mconcat :: [Source] -> Source Source #
Semigroup Source Source # |
Instance details Defined in Data.Ipynb Methods (<>) :: Source -> Source -> Source Source # sconcat :: NonEmpty Source -> Source Source # stimes :: Integral b => b -> Source -> Source Source #
Generic Source Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep Source |
Instance details Defined in Data.Ipynb type Rep Source = D1 ('MetaData "Source" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "Source" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

Methods

from :: Source -> Rep Source x Source #

to :: Rep Source x -> Source Source #

Show Source Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Source -> ShowS Source # show :: Source -> String Source # showList :: [Source] -> ShowS Source #
Eq Source Source # |
Instance details Defined in Data.Ipynb Methods (==) :: Source -> Source -> Bool Source # (/=) :: Source -> Source -> Bool Source #
type Rep Source Source # |
Instance details Defined in Data.Ipynb type Rep Source = D1 ('MetaData "Source" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "Source" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

data CellType a Source #

Information about the type of a notebook cell, plus data specific to that type. note that `Heading` is for v3 only; a `Heading` will be rendered as `Markdown` in v4.

Constructors

Markdown |
Heading |

Fields

- headingLevel :: Int

Raw |
Code |

Fields

- codeExecutionCount :: Maybe Int
- codeOutputs :: [Output a]

#### Instances

Instances details

Generic (CellType a) Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep (CellType a) |

Instance details

Defined in Data.Ipynb

type Rep (CellType a) = D1 ('MetaData "CellType" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) ((C1 ('MetaCons "Markdown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Heading" 'PrefixI 'True) (S1 ('MetaSel ('Just "headingLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "Raw" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Code" 'PrefixI 'True) (S1 ('MetaSel ('Just "codeExecutionCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "codeOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Output a]))))

Methods

from :: CellType a -> Rep (CellType a) x Source #

to :: Rep (CellType a) x -> CellType a Source #

Show (CellType a) Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> CellType a -> ShowS Source # show :: CellType a -> String Source # showList :: [CellType a] -> ShowS Source #
Eq (CellType a) Source # |
Instance details Defined in Data.Ipynb Methods (==) :: CellType a -> CellType a -> Bool Source # (/=) :: CellType a -> CellType a -> Bool Source #
type Rep (CellType a) Source # |

Instance details

Defined in Data.Ipynb

type Rep (CellType a) = D1 ('MetaData "CellType" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) ((C1 ('MetaCons "Markdown" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Heading" 'PrefixI 'True) (S1 ('MetaSel ('Just "headingLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "Raw" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Code" 'PrefixI 'True) (S1 ('MetaSel ('Just "codeExecutionCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "codeOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Output a]))))

data Output a Source #

Output from a Code cell.

Constructors

Stream |

Fields

- streamName :: Text
- streamText :: Source

DisplayData |

Fields

- displayData :: MimeBundle
- displayMetadata :: JSONMeta

ExecuteResult |

Fields

- executeCount :: Int
- executeData :: MimeBundle
- executeMetadata :: JSONMeta

Err |

Fields

- errName :: Text
- errValue :: Text
- errTraceback :: [Text]

#### Instances

Instances details

FromJSON (Output NbV3) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Output NbV3) Source # parseJSONList :: Value -> Parser [Output NbV3] Source # omittedField :: Maybe (Output NbV3) Source #
FromJSON (Output NbV4) Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Output NbV4) Source # parseJSONList :: Value -> Parser [Output NbV4] Source # omittedField :: Maybe (Output NbV4) Source #
ToJSON (Output NbV3) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Output NbV3 -> Value Source # toEncoding :: Output NbV3 -> Encoding Source # toJSONList :: [Output NbV3] -> Value Source # toEncodingList :: [Output NbV3] -> Encoding Source # omitField :: Output NbV3 -> Bool Source #
ToJSON (Output NbV4) Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Output NbV4 -> Value Source # toEncoding :: Output NbV4 -> Encoding Source # toJSONList :: [Output NbV4] -> Value Source # toEncodingList :: [Output NbV4] -> Encoding Source # omitField :: Output NbV4 -> Bool Source #
Generic (Output a) Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep (Output a) |

Instance details

Defined in Data.Ipynb

type Rep (Output a) = D1 ('MetaData "Output" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) ((C1 ('MetaCons "Stream" 'PrefixI 'True) (S1 ('MetaSel ('Just "streamName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "streamText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Source)) :+: C1 ('MetaCons "DisplayData" 'PrefixI 'True) (S1 ('MetaSel ('Just "displayData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MimeBundle) :*: S1 ('MetaSel ('Just "displayMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta))) :+: (C1 ('MetaCons "ExecuteResult" 'PrefixI 'True) (S1 ('MetaSel ('Just "executeCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "executeData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MimeBundle) :*: S1 ('MetaSel ('Just "executeMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta))) :+: C1 ('MetaCons "Err" 'PrefixI 'True) (S1 ('MetaSel ('Just "errName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "errValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "errTraceback") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))))

Methods

from :: Output a -> Rep (Output a) x Source #

to :: Rep (Output a) x -> Output a Source #

Show (Output a) Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Output a -> ShowS Source # show :: Output a -> String Source # showList :: [Output a] -> ShowS Source #
Eq (Output a) Source # |
Instance details Defined in Data.Ipynb Methods (==) :: Output a -> Output a -> Bool Source # (/=) :: Output a -> Output a -> Bool Source #
type Rep (Output a) Source # |

Instance details

Defined in Data.Ipynb

type Rep (Output a) = D1 ('MetaData "Output" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) ((C1 ('MetaCons "Stream" 'PrefixI 'True) (S1 ('MetaSel ('Just "streamName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "streamText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Source)) :+: C1 ('MetaCons "DisplayData" 'PrefixI 'True) (S1 ('MetaSel ('Just "displayData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MimeBundle) :*: S1 ('MetaSel ('Just "displayMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta))) :+: (C1 ('MetaCons "ExecuteResult" 'PrefixI 'True) (S1 ('MetaSel ('Just "executeCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "executeData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MimeBundle) :*: S1 ('MetaSel ('Just "executeMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JSONMeta))) :+: C1 ('MetaCons "Err" 'PrefixI 'True) (S1 ('MetaSel ('Just "errName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "errValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "errTraceback") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))))

type MimeType = Text Source #

data MimeData Source #

Data in an execution result or display data cell.

Constructors

BinaryData ByteString |
TextualData Text |
JsonData Value |

#### Instances

Instances details

ToJSON MimeData Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: MimeData -> Value Source # toEncoding :: MimeData -> Encoding Source # toJSONList :: [MimeData] -> Value Source # toEncodingList :: [MimeData] -> Encoding Source # omitField :: MimeData -> Bool Source #
Generic MimeData Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep MimeData |

Instance details

Defined in Data.Ipynb

type Rep MimeData = D1 ('MetaData "MimeData" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) (C1 ('MetaCons "BinaryData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)) :+: (C1 ('MetaCons "TextualData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "JsonData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))

Methods

from :: MimeData -> Rep MimeData x Source #

to :: Rep MimeData x -> MimeData Source #

Show MimeData Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> MimeData -> ShowS Source # show :: MimeData -> String Source # showList :: [MimeData] -> ShowS Source #
Eq MimeData Source # |
Instance details Defined in Data.Ipynb Methods (==) :: MimeData -> MimeData -> Bool Source # (/=) :: MimeData -> MimeData -> Bool Source #
Ord MimeData Source # |
Instance details Defined in Data.Ipynb Methods compare :: MimeData -> MimeData -> Ordering Source # (<) :: MimeData -> MimeData -> Bool Source # (<=) :: MimeData -> MimeData -> Bool Source # (>) :: MimeData -> MimeData -> Bool Source # (>=) :: MimeData -> MimeData -> Bool Source # max :: MimeData -> MimeData -> MimeData Source # min :: MimeData -> MimeData -> MimeData Source #
type Rep MimeData Source # |

Instance details

Defined in Data.Ipynb

type Rep MimeData = D1 ('MetaData "MimeData" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'False) (C1 ('MetaCons "BinaryData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)) :+: (C1 ('MetaCons "TextualData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "JsonData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))

newtype MimeBundle Source #

A `MimeBundle` wraps a map from mime types to mime data.

Constructors

MimeBundle |

Fields

- unMimeBundle :: Map MimeType MimeData

#### Instances

Instances details

FromJSON MimeBundle Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser MimeBundle Source # parseJSONList :: Value -> Parser [MimeBundle] Source # omittedField :: Maybe MimeBundle Source #
ToJSON MimeBundle Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: MimeBundle -> Value Source # toEncoding :: MimeBundle -> Encoding Source # toJSONList :: [MimeBundle] -> Value Source # toEncodingList :: [MimeBundle] -> Encoding Source # omitField :: MimeBundle -> Bool Source #
Monoid MimeBundle Source # |
Instance details Defined in Data.Ipynb Methods mempty :: MimeBundle Source # mappend :: MimeBundle -> MimeBundle -> MimeBundle Source # mconcat :: [MimeBundle] -> MimeBundle Source #
Semigroup MimeBundle Source # |
Instance details Defined in Data.Ipynb Methods (<>) :: MimeBundle -> MimeBundle -> MimeBundle Source # sconcat :: NonEmpty MimeBundle -> MimeBundle Source # stimes :: Integral b => b -> MimeBundle -> MimeBundle Source #
Generic MimeBundle Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep MimeBundle |
Instance details Defined in Data.Ipynb type Rep MimeBundle = D1 ('MetaData "MimeBundle" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "MimeBundle" 'PrefixI 'True) (S1 ('MetaSel ('Just "unMimeBundle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map MimeType MimeData))))

Methods

from :: MimeBundle -> Rep MimeBundle x Source #

to :: Rep MimeBundle x -> MimeBundle Source #

Show MimeBundle Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> MimeBundle -> ShowS Source # show :: MimeBundle -> String Source # showList :: [MimeBundle] -> ShowS Source #
Eq MimeBundle Source # |
Instance details Defined in Data.Ipynb Methods (==) :: MimeBundle -> MimeBundle -> Bool Source # (/=) :: MimeBundle -> MimeBundle -> Bool Source #
Ord MimeBundle Source # |

Instance details

Defined in Data.Ipynb

Methods

compare :: MimeBundle -> MimeBundle -> Ordering Source #

(<) :: MimeBundle -> MimeBundle -> Bool Source #

(<=) :: MimeBundle -> MimeBundle -> Bool Source #

(>) :: MimeBundle -> MimeBundle -> Bool Source #

(>=) :: MimeBundle -> MimeBundle -> Bool Source #

max :: MimeBundle -> MimeBundle -> MimeBundle Source #

min :: MimeBundle -> MimeBundle -> MimeBundle Source #

type Rep MimeBundle Source # |
Instance details Defined in Data.Ipynb type Rep MimeBundle = D1 ('MetaData "MimeBundle" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "MimeBundle" 'PrefixI 'True) (S1 ('MetaSel ('Just "unMimeBundle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map MimeType MimeData))))

newtype MimeAttachments Source #

Constructors

MimeAttachments (Map Text MimeBundle) |

#### Instances

Instances details

FromJSON MimeAttachments Source # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser MimeAttachments Source # parseJSONList :: Value -> Parser [MimeAttachments] Source # omittedField :: Maybe MimeAttachments Source #
ToJSON MimeAttachments Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: MimeAttachments -> Value Source # toEncoding :: MimeAttachments -> Encoding Source # toJSONList :: [MimeAttachments] -> Value Source # toEncodingList :: [MimeAttachments] -> Encoding Source # omitField :: MimeAttachments -> Bool Source #
Monoid MimeAttachments Source # |
Instance details Defined in Data.Ipynb Methods mempty :: MimeAttachments Source # mappend :: MimeAttachments -> MimeAttachments -> MimeAttachments Source # mconcat :: [MimeAttachments] -> MimeAttachments Source #
Semigroup MimeAttachments Source # |
Instance details Defined in Data.Ipynb Methods (<>) :: MimeAttachments -> MimeAttachments -> MimeAttachments Source # sconcat :: NonEmpty MimeAttachments -> MimeAttachments Source # stimes :: Integral b => b -> MimeAttachments -> MimeAttachments Source #
Generic MimeAttachments Source # |

Instance details

Defined in Data.Ipynb

Associated Types

type Rep MimeAttachments |
Instance details Defined in Data.Ipynb type Rep MimeAttachments = D1 ('MetaData "MimeAttachments" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "MimeAttachments" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text MimeBundle))))

Methods

from :: MimeAttachments -> Rep MimeAttachments x Source #

to :: Rep MimeAttachments x -> MimeAttachments Source #

Show MimeAttachments Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> MimeAttachments -> ShowS Source # show :: MimeAttachments -> String Source # showList :: [MimeAttachments] -> ShowS Source #
Eq MimeAttachments Source # |
Instance details Defined in Data.Ipynb Methods (==) :: MimeAttachments -> MimeAttachments -> Bool Source # (/=) :: MimeAttachments -> MimeAttachments -> Bool Source #
Ord MimeAttachments Source # |

Instance details

Defined in Data.Ipynb

Methods

compare :: MimeAttachments -> MimeAttachments -> Ordering Source #

(<) :: MimeAttachments -> MimeAttachments -> Bool Source #

(<=) :: MimeAttachments -> MimeAttachments -> Bool Source #

(>) :: MimeAttachments -> MimeAttachments -> Bool Source #

(>=) :: MimeAttachments -> MimeAttachments -> Bool Source #

max :: MimeAttachments -> MimeAttachments -> MimeAttachments Source #

min :: MimeAttachments -> MimeAttachments -> MimeAttachments Source #

type Rep MimeAttachments Source # |
Instance details Defined in Data.Ipynb type Rep MimeAttachments = D1 ('MetaData "MimeAttachments" "Data.Ipynb" "ipynb-0.2-FV07SYHZi8vFzM4tFGRXC" 'True) (C1 ('MetaCons "MimeAttachments" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text MimeBundle))))

breakLines :: Text -> [Text] Source #

Break up a string into a list of strings, each representing one line of the string (including trailing newline if any).