Data.Ipynb

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 | Safe-Inferred
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 #

A Jupyter notebook.

Constructors

Notebook |
Fields notebookMetadata :: JSONMeta notebookFormat :: (Int, Int) notebookCells :: [Cell a]

#### Instances

Instances details

FromJSON (Notebook NbV3) # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Notebook NbV3) # parseJSONList :: Value -> Parser [Notebook NbV3] #
FromJSON (Notebook NbV4) # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Notebook NbV4) # parseJSONList :: Value -> Parser [Notebook NbV4] #
ToJSON (Notebook NbV3) # |
Instance details Defined in Data.Ipynb Methods toJSON :: Notebook NbV3 -> Value # toEncoding :: Notebook NbV3 -> Encoding # toJSONList :: [Notebook NbV3] -> Value # toEncodingList :: [Notebook NbV3] -> Encoding #
ToJSON (Notebook NbV4) # |
Instance details Defined in Data.Ipynb Methods toJSON :: Notebook NbV4 -> Value # toEncoding :: Notebook NbV4 -> Encoding # toJSONList :: [Notebook NbV4] -> Value # toEncodingList :: [Notebook NbV4] -> Encoding #
Monoid (Notebook a) # |
Instance details Defined in Data.Ipynb Methods mempty :: Notebook a # mappend :: Notebook a -> Notebook a -> Notebook a # mconcat :: [Notebook a] -> Notebook a #
Semigroup (Notebook a) # |
Instance details Defined in Data.Ipynb Methods (<>) :: Notebook a -> Notebook a -> Notebook a # sconcat :: NonEmpty (Notebook a) -> Notebook a # stimes :: Integral b => b -> Notebook a -> Notebook a #
Generic (Notebook a) # |
Instance details Defined in Data.Ipynb Associated Types type Rep (Notebook a) :: Type -> Type # Methods from :: Notebook a -> Rep (Notebook a) x # to :: Rep (Notebook a) x -> Notebook a #
Show (Notebook a) # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Notebook a -> ShowS # show :: Notebook a -> String # showList :: [Notebook a] -> ShowS #
Eq (Notebook a) # |
Instance details Defined in Data.Ipynb Methods (==) :: Notebook a -> Notebook a -> Bool # (/=) :: Notebook a -> Notebook a -> Bool #
type Rep (Notebook a) # |
Instance details Defined in Data.Ipynb type Rep (Notebook a) = D1 ('MetaData "Notebook" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" '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 #

Indexes `Notebook` for serialization as nbformat version 3.

#### Instances

Instances details

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

data NbV4 #

Indexes `Notebook` for serialization as nbformat version 4.

#### Instances

Instances details

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

newtype JSONMeta #

Constructors

JSONMeta (Map Text Value) |

#### Instances

Instances details

FromJSON JSONMeta # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser JSONMeta # parseJSONList :: Value -> Parser [JSONMeta] #
ToJSON JSONMeta # |
Instance details Defined in Data.Ipynb Methods toJSON :: JSONMeta -> Value # toEncoding :: JSONMeta -> Encoding # toJSONList :: [JSONMeta] -> Value # toEncodingList :: [JSONMeta] -> Encoding #
Monoid JSONMeta # |
Instance details Defined in Data.Ipynb Methods mempty :: JSONMeta # mappend :: JSONMeta -> JSONMeta -> JSONMeta # mconcat :: [JSONMeta] -> JSONMeta #
Semigroup JSONMeta # |
Instance details Defined in Data.Ipynb Methods (<>) :: JSONMeta -> JSONMeta -> JSONMeta # sconcat :: NonEmpty JSONMeta -> JSONMeta # stimes :: Integral b => b -> JSONMeta -> JSONMeta #
Generic JSONMeta # |
Instance details Defined in Data.Ipynb Associated Types type Rep JSONMeta :: Type -> Type # Methods from :: JSONMeta -> Rep JSONMeta x # to :: Rep JSONMeta x -> JSONMeta #
Show JSONMeta # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> JSONMeta -> ShowS # show :: JSONMeta -> String # showList :: [JSONMeta] -> ShowS #
Eq JSONMeta # |
Instance details Defined in Data.Ipynb Methods (==) :: JSONMeta -> JSONMeta -> Bool # (/=) :: JSONMeta -> JSONMeta -> Bool #
Ord JSONMeta # |
Instance details Defined in Data.Ipynb Methods compare :: JSONMeta -> JSONMeta -> Ordering # (<) :: JSONMeta -> JSONMeta -> Bool # (<=) :: JSONMeta -> JSONMeta -> Bool # (>) :: JSONMeta -> JSONMeta -> Bool # (>=) :: JSONMeta -> JSONMeta -> Bool # max :: JSONMeta -> JSONMeta -> JSONMeta # min :: JSONMeta -> JSONMeta -> JSONMeta #
type Rep JSONMeta # |
Instance details Defined in Data.Ipynb type Rep JSONMeta = D1 ('MetaData "JSONMeta" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" 'True) (C1 ('MetaCons "JSONMeta" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Value))))

data Cell a #

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) # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Cell NbV3) # parseJSONList :: Value -> Parser [Cell NbV3] #
FromJSON (Cell NbV4) # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Cell NbV4) # parseJSONList :: Value -> Parser [Cell NbV4] #
ToJSON (Cell NbV3) # |
Instance details Defined in Data.Ipynb Methods toJSON :: Cell NbV3 -> Value # toEncoding :: Cell NbV3 -> Encoding # toJSONList :: [Cell NbV3] -> Value # toEncodingList :: [Cell NbV3] -> Encoding #
ToJSON (Cell NbV4) # |
Instance details Defined in Data.Ipynb Methods toJSON :: Cell NbV4 -> Value # toEncoding :: Cell NbV4 -> Encoding # toJSONList :: [Cell NbV4] -> Value # toEncodingList :: [Cell NbV4] -> Encoding #
Generic (Cell a) # |
Instance details Defined in Data.Ipynb Associated Types type Rep (Cell a) :: Type -> Type # Methods from :: Cell a -> Rep (Cell a) x # to :: Rep (Cell a) x -> Cell a #
Show (Cell a) # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Cell a -> ShowS # show :: Cell a -> String # showList :: [Cell a] -> ShowS #
Eq (Cell a) # |
Instance details Defined in Data.Ipynb Methods (==) :: Cell a -> Cell a -> Bool # (/=) :: Cell a -> Cell a -> Bool #
type Rep (Cell a) # |
Instance details Defined in Data.Ipynb type Rep (Cell a) = D1 ('MetaData "Cell" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" '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 #

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 # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser Source # parseJSONList :: Value -> Parser [Source] #
ToJSON Source # |
Instance details Defined in Data.Ipynb Methods toJSON :: Source -> Value # toEncoding :: Source -> Encoding # toJSONList :: [Source] -> Value # toEncodingList :: [Source] -> Encoding #
Monoid Source # |
Instance details Defined in Data.Ipynb Methods mempty :: Source # mappend :: Source -> Source -> Source # mconcat :: [Source] -> Source #
Semigroup Source # |
Instance details Defined in Data.Ipynb Methods (<>) :: Source -> Source -> Source # sconcat :: NonEmpty Source -> Source # stimes :: Integral b => b -> Source -> Source #
Generic Source # |
Instance details Defined in Data.Ipynb Associated Types type Rep Source :: Type -> Type # Methods from :: Source -> Rep Source x # to :: Rep Source x -> Source #
Show Source # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Source -> ShowS # show :: Source -> String # showList :: [Source] -> ShowS #
Eq Source # |
Instance details Defined in Data.Ipynb Methods (==) :: Source -> Source -> Bool # (/=) :: Source -> Source -> Bool #
type Rep Source # |
Instance details Defined in Data.Ipynb type Rep Source = D1 ('MetaData "Source" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" 'True) (C1 ('MetaCons "Source" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])))

data CellType a #

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) # |
Instance details Defined in Data.Ipynb Associated Types type Rep (CellType a) :: Type -> Type # Methods from :: CellType a -> Rep (CellType a) x # to :: Rep (CellType a) x -> CellType a #
Show (CellType a) # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> CellType a -> ShowS # show :: CellType a -> String # showList :: [CellType a] -> ShowS #
Eq (CellType a) # |
Instance details Defined in Data.Ipynb Methods (==) :: CellType a -> CellType a -> Bool # (/=) :: CellType a -> CellType a -> Bool #
type Rep (CellType a) # |
Instance details Defined in Data.Ipynb type Rep (CellType a) = D1 ('MetaData "CellType" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" '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 #

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) # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Output NbV3) # parseJSONList :: Value -> Parser [Output NbV3] #
FromJSON (Output NbV4) # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser (Output NbV4) # parseJSONList :: Value -> Parser [Output NbV4] #
ToJSON (Output NbV3) # |
Instance details Defined in Data.Ipynb Methods toJSON :: Output NbV3 -> Value # toEncoding :: Output NbV3 -> Encoding # toJSONList :: [Output NbV3] -> Value # toEncodingList :: [Output NbV3] -> Encoding #
ToJSON (Output NbV4) # |
Instance details Defined in Data.Ipynb Methods toJSON :: Output NbV4 -> Value # toEncoding :: Output NbV4 -> Encoding # toJSONList :: [Output NbV4] -> Value # toEncodingList :: [Output NbV4] -> Encoding #
Generic (Output a) # |
Instance details Defined in Data.Ipynb Associated Types type Rep (Output a) :: Type -> Type # Methods from :: Output a -> Rep (Output a) x # to :: Rep (Output a) x -> Output a #
Show (Output a) # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> Output a -> ShowS # show :: Output a -> String # showList :: [Output a] -> ShowS #
Eq (Output a) # |
Instance details Defined in Data.Ipynb Methods (==) :: Output a -> Output a -> Bool # (/=) :: Output a -> Output a -> Bool #
type Rep (Output a) # |
Instance details Defined in Data.Ipynb type Rep (Output a) = D1 ('MetaData "Output" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" '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 #

data MimeData #

Data in an execution result or display data cell.

Constructors

BinaryData ByteString |
TextualData Text |
JsonData Value |

#### Instances

Instances details

ToJSON MimeData # |
Instance details Defined in Data.Ipynb Methods toJSON :: MimeData -> Value # toEncoding :: MimeData -> Encoding # toJSONList :: [MimeData] -> Value # toEncodingList :: [MimeData] -> Encoding #
Generic MimeData # |
Instance details Defined in Data.Ipynb Associated Types type Rep MimeData :: Type -> Type # Methods from :: MimeData -> Rep MimeData x # to :: Rep MimeData x -> MimeData #
Show MimeData # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> MimeData -> ShowS # show :: MimeData -> String # showList :: [MimeData] -> ShowS #
Eq MimeData # |
Instance details Defined in Data.Ipynb Methods (==) :: MimeData -> MimeData -> Bool # (/=) :: MimeData -> MimeData -> Bool #
Ord MimeData # |
Instance details Defined in Data.Ipynb Methods compare :: MimeData -> MimeData -> Ordering # (<) :: MimeData -> MimeData -> Bool # (<=) :: MimeData -> MimeData -> Bool # (>) :: MimeData -> MimeData -> Bool # (>=) :: MimeData -> MimeData -> Bool # max :: MimeData -> MimeData -> MimeData # min :: MimeData -> MimeData -> MimeData #
type Rep MimeData # |
Instance details Defined in Data.Ipynb type Rep MimeData = D1 ('MetaData "MimeData" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" '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 #

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

Constructors

MimeBundle |
Fields unMimeBundle :: Map MimeType MimeData

#### Instances

Instances details

FromJSON MimeBundle # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser MimeBundle # parseJSONList :: Value -> Parser [MimeBundle] #
ToJSON MimeBundle # |
Instance details Defined in Data.Ipynb Methods toJSON :: MimeBundle -> Value # toEncoding :: MimeBundle -> Encoding # toJSONList :: [MimeBundle] -> Value # toEncodingList :: [MimeBundle] -> Encoding #
Monoid MimeBundle # |
Instance details Defined in Data.Ipynb Methods mempty :: MimeBundle # mappend :: MimeBundle -> MimeBundle -> MimeBundle # mconcat :: [MimeBundle] -> MimeBundle #
Semigroup MimeBundle # |
Instance details Defined in Data.Ipynb Methods (<>) :: MimeBundle -> MimeBundle -> MimeBundle # sconcat :: NonEmpty MimeBundle -> MimeBundle # stimes :: Integral b => b -> MimeBundle -> MimeBundle #
Generic MimeBundle # |
Instance details Defined in Data.Ipynb Associated Types type Rep MimeBundle :: Type -> Type # Methods from :: MimeBundle -> Rep MimeBundle x # to :: Rep MimeBundle x -> MimeBundle #
Show MimeBundle # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> MimeBundle -> ShowS # show :: MimeBundle -> String # showList :: [MimeBundle] -> ShowS #
Eq MimeBundle # |
Instance details Defined in Data.Ipynb Methods (==) :: MimeBundle -> MimeBundle -> Bool # (/=) :: MimeBundle -> MimeBundle -> Bool #
Ord MimeBundle # |
Instance details Defined in Data.Ipynb Methods compare :: MimeBundle -> MimeBundle -> Ordering # (<) :: MimeBundle -> MimeBundle -> Bool # (<=) :: MimeBundle -> MimeBundle -> Bool # (>) :: MimeBundle -> MimeBundle -> Bool # (>=) :: MimeBundle -> MimeBundle -> Bool # max :: MimeBundle -> MimeBundle -> MimeBundle # min :: MimeBundle -> MimeBundle -> MimeBundle #
type Rep MimeBundle # |
Instance details Defined in Data.Ipynb type Rep MimeBundle = D1 ('MetaData "MimeBundle" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" 'True) (C1 ('MetaCons "MimeBundle" 'PrefixI 'True) (S1 ('MetaSel ('Just "unMimeBundle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map MimeType MimeData))))

newtype MimeAttachments #

Constructors

MimeAttachments (Map Text MimeBundle) |

#### Instances

Instances details

FromJSON MimeAttachments # |
Instance details Defined in Data.Ipynb Methods parseJSON :: Value -> Parser MimeAttachments # parseJSONList :: Value -> Parser [MimeAttachments] #
ToJSON MimeAttachments # |
Instance details Defined in Data.Ipynb Methods toJSON :: MimeAttachments -> Value # toEncoding :: MimeAttachments -> Encoding # toJSONList :: [MimeAttachments] -> Value # toEncodingList :: [MimeAttachments] -> Encoding #
Monoid MimeAttachments # |
Instance details Defined in Data.Ipynb Methods mempty :: MimeAttachments # mappend :: MimeAttachments -> MimeAttachments -> MimeAttachments # mconcat :: [MimeAttachments] -> MimeAttachments #
Semigroup MimeAttachments # |
Instance details Defined in Data.Ipynb Methods (<>) :: MimeAttachments -> MimeAttachments -> MimeAttachments # sconcat :: NonEmpty MimeAttachments -> MimeAttachments # stimes :: Integral b => b -> MimeAttachments -> MimeAttachments #
Generic MimeAttachments # |
Instance details Defined in Data.Ipynb Associated Types type Rep MimeAttachments :: Type -> Type # Methods from :: MimeAttachments -> Rep MimeAttachments x # to :: Rep MimeAttachments x -> MimeAttachments #
Show MimeAttachments # |
Instance details Defined in Data.Ipynb Methods showsPrec :: Int -> MimeAttachments -> ShowS # show :: MimeAttachments -> String # showList :: [MimeAttachments] -> ShowS #
Eq MimeAttachments # |
Instance details Defined in Data.Ipynb Methods (==) :: MimeAttachments -> MimeAttachments -> Bool # (/=) :: MimeAttachments -> MimeAttachments -> Bool #
Ord MimeAttachments # |
Instance details Defined in Data.Ipynb Methods compare :: MimeAttachments -> MimeAttachments -> Ordering # (<) :: MimeAttachments -> MimeAttachments -> Bool # (<=) :: MimeAttachments -> MimeAttachments -> Bool # (>) :: MimeAttachments -> MimeAttachments -> Bool # (>=) :: MimeAttachments -> MimeAttachments -> Bool # max :: MimeAttachments -> MimeAttachments -> MimeAttachments # min :: MimeAttachments -> MimeAttachments -> MimeAttachments #
type Rep MimeAttachments # |
Instance details Defined in Data.Ipynb type Rep MimeAttachments = D1 ('MetaData "MimeAttachments" "Data.Ipynb" "ipynb-0.2-7F2apkdWdJl8nrrHV4v1q3" 'True) (C1 ('MetaCons "MimeAttachments" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text MimeBundle))))

breakLines :: Text -> [Text] #

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