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


-- | A library for creating kernels for IPython frontends
--   
--   ipython-kernel is a library for communicating with frontends for the
--   interactive IPython framework. It is used extensively in IHaskell, the
--   interactive Haskell environment.
@package ipython-kernel
@version 0.9.0.2


-- | Generate, parse, and pretty print UUIDs for use with IPython.
module IHaskell.IPython.Message.UUID

-- | A UUID (universally unique identifier).
data UUID

-- | Generate a single random UUID.
random :: IO UUID

-- | Generate a list of random UUIDs.
randoms :: Int -> IO [UUID]
uuidToString :: UUID -> String
instance GHC.Classes.Ord IHaskell.IPython.Message.UUID.UUID
instance GHC.Classes.Eq IHaskell.IPython.Message.UUID.UUID
instance GHC.Read.Read IHaskell.IPython.Message.UUID.UUID
instance GHC.Show.Show IHaskell.IPython.Message.UUID.UUID
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Message.UUID.UUID
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Message.UUID.UUID


-- | This module contains all types used to create an IPython language
--   kernel.
module IHaskell.IPython.Types

-- | A kernel profile, specifying how the kernel communicates.
data Profile
Profile :: IP -> Transport -> Port -> Port -> Port -> Port -> Port -> ByteString -> Profile

-- | The IP on which to listen.
[ip] :: Profile -> IP

-- | The transport mechanism.
[transport] :: Profile -> Transport

-- | The stdin channel port.
[stdinPort] :: Profile -> Port

-- | The control channel port.
[controlPort] :: Profile -> Port

-- | The heartbeat channel port.
[hbPort] :: Profile -> Port

-- | The shell command port.
[shellPort] :: Profile -> Port

-- | The IOPub port.
[iopubPort] :: Profile -> Port

-- | The HMAC encryption key.
[signatureKey] :: Profile -> ByteString

-- | The transport mechanism used to communicate with the IPython frontend.
data Transport

-- | Default transport mechanism via TCP.
TCP :: Transport

-- | A TCP port.
type Port = Int

-- | An IP address.
type IP = String
data KernelSpec
KernelSpec :: String -> String -> [String] -> KernelSpec

-- | Name shown to users to describe this kernel (e.g. <a>Haskell</a>)
[kernelDisplayName] :: KernelSpec -> String

-- | Name for the kernel; unique kernel identifier (e.g. "haskell")
[kernelLanguage] :: KernelSpec -> String

-- | Command to run to start the kernel. One of the strings maybe
--   <tt>"{connection_file}"</tt>, which will be replaced by the path to a
--   kernel profile file (see <tt>Profile</tt>) when the command is run.
[kernelCommand] :: KernelSpec -> [String]

-- | A message used to communicate with the IPython frontend.
data Message

-- | A request from a frontend for information about the kernel.
KernelInfoRequest :: MessageHeader -> Message
[header] :: Message -> MessageHeader

-- | A response to a KernelInfoRequest.
KernelInfoReply :: MessageHeader -> String -> String -> String -> String -> LanguageInfo -> Message
[header] :: Message -> MessageHeader

-- | current protocol version, major and minor
[protocolVersion] :: Message -> String

-- | Kernel information description e.g. (IHaskell 0.8.3.0 GHC 7.10.2)
[banner] :: Message -> String

-- | e.g. IHaskell
[implementation] :: Message -> String

-- | The version of the implementation
[implementationVersion] :: Message -> String
[languageInfo] :: Message -> LanguageInfo

-- | A request from a frontend for information about the comms.
CommInfoRequest :: MessageHeader -> Message
[header] :: Message -> MessageHeader

-- | A response to a CommInfoRequest.
CommInfoReply :: MessageHeader -> Map String String -> Message
[header] :: Message -> MessageHeader

-- | A dictionary of the comms, indexed by uuids.
[commInfo] :: Message -> Map String String

-- | A request from a frontend to execute some code.
ExecuteInput :: MessageHeader -> Text -> Int -> Message
[header] :: Message -> MessageHeader

-- | The code string.
[getCode] :: Message -> Text

-- | The execution count, i.e. which output this is.
[executionCounter] :: Message -> Int

-- | A request from a frontend to execute some code.
ExecuteRequest :: MessageHeader -> Text -> Bool -> Bool -> Bool -> [Text] -> [Text] -> Message
[header] :: Message -> MessageHeader

-- | The code string.
[getCode] :: Message -> Text

-- | Whether this should be silently executed.
[getSilent] :: Message -> Bool

-- | Whether to store this in history.
[getStoreHistory] :: Message -> Bool

-- | Whether this code can use stdin.
[getAllowStdin] :: Message -> Bool

-- | Unused.
[getUserVariables] :: Message -> [Text]

-- | Unused.
[getUserExpressions] :: Message -> [Text]

-- | A reply to an execute request.
ExecuteReply :: MessageHeader -> ExecuteReplyStatus -> [DisplayData] -> Int -> Message
[header] :: Message -> MessageHeader

-- | The status of the output.
[status] :: Message -> ExecuteReplyStatus

-- | The mimebundles to display in the pager.
[pagerOutput] :: Message -> [DisplayData]

-- | The execution count, i.e. which output this is.
[executionCounter] :: Message -> Int

-- | A reply to an execute request.
ExecuteResult :: MessageHeader -> [DisplayData] -> Map String String -> Int -> Message
[header] :: Message -> MessageHeader

-- | Key/value pairs (keys are MIME types)
[dataResult] :: Message -> [DisplayData]

-- | Any metadata that describes the data
[metadataResult] :: Message -> Map String String

-- | The execution count, i.e. which output this is.
[executionCounter] :: Message -> Int

-- | An error reply to an execute request
ExecuteError :: MessageHeader -> [DisplayData] -> [Text] -> Text -> Text -> Message
[header] :: Message -> MessageHeader

-- | The mimebundles to display in the pager.
[pagerOutput] :: Message -> [DisplayData]
[traceback] :: Message -> [Text]
[ename] :: Message -> Text
[evalue] :: Message -> Text
PublishStatus :: MessageHeader -> ExecutionState -> Message
[header] :: Message -> MessageHeader

-- | The execution state of the kernel.
[executionState] :: Message -> ExecutionState
PublishStream :: MessageHeader -> StreamType -> String -> Message
[header] :: Message -> MessageHeader

-- | Which stream to publish to.
[streamType] :: Message -> StreamType

-- | What to publish.
[streamContent] :: Message -> String
PublishDisplayData :: MessageHeader -> String -> [DisplayData] -> Message
[header] :: Message -> MessageHeader

-- | The name of the data source.
[source] :: Message -> String

-- | A list of data representations.
[displayData] :: Message -> [DisplayData]
PublishOutput :: MessageHeader -> String -> Int -> Message
[header] :: Message -> MessageHeader

-- | Printed output text.
[reprText] :: Message -> String

-- | Which output this is for.
[executionCount] :: Message -> Int
PublishInput :: MessageHeader -> String -> Int -> Message
[header] :: Message -> MessageHeader

-- | Submitted input code.
[inCode] :: Message -> String

-- | Which output this is for.
[executionCount] :: Message -> Int
Input :: MessageHeader -> Text -> Int -> Message
[header] :: Message -> MessageHeader

-- | The code string.
[getCode] :: Message -> Text

-- | Which output this is for.
[executionCount] :: Message -> Int
Output :: MessageHeader -> [DisplayData] -> Int -> Message
[header] :: Message -> MessageHeader
[getText] :: Message -> [DisplayData]

-- | Which output this is for.
[executionCount] :: Message -> Int
IsCompleteRequest :: MessageHeader -> String -> Message
[header] :: Message -> MessageHeader

-- | The code entered in the repl.
[inputToReview] :: Message -> String
IsCompleteReply :: MessageHeader -> CodeReview -> Message
[header] :: Message -> MessageHeader

-- | The result of reviewing the code.
[reviewResult] :: Message -> CodeReview
CompleteRequest :: MessageHeader -> Text -> Int -> Message
[header] :: Message -> MessageHeader

-- | The code string.
[getCode] :: Message -> Text

-- | Position of the cursor in unicode characters. json field
--   <tt>cursor_pos</tt>
[getCursorPos] :: Message -> Int
CompleteReply :: MessageHeader -> [Text] -> Int -> Int -> Metadata -> Bool -> Message
[header] :: Message -> MessageHeader
[completionMatches] :: Message -> [Text]
[completionCursorStart] :: Message -> Int
[completionCursorEnd] :: Message -> Int
[completionMetadata] :: Message -> Metadata
[completionStatus] :: Message -> Bool
InspectRequest :: MessageHeader -> Text -> Int -> Int -> Message
[header] :: Message -> MessageHeader

-- | The code context in which introspection is requested
[inspectCode] :: Message -> Text

-- | Position of the cursor in unicode characters. json field
--   <tt>cursor_pos</tt>
[inspectCursorPos] :: Message -> Int

-- | Level of detail desired (defaults to 0). 0 is equivalent to foo?, 1 is
--   equivalent to foo??.
[detailLevel] :: Message -> Int
InspectReply :: MessageHeader -> Bool -> [DisplayData] -> Message
[header] :: Message -> MessageHeader

-- | whether the request succeeded or failed
[inspectStatus] :: Message -> Bool

-- | <tt>inspectData</tt> can be empty if nothing is found
[inspectData] :: Message -> [DisplayData]
ShutdownRequest :: MessageHeader -> Bool -> Message
[header] :: Message -> MessageHeader

-- | Whether this shutdown precedes a restart.
[restartPending] :: Message -> Bool
ShutdownReply :: MessageHeader -> Bool -> Message
[header] :: Message -> MessageHeader

-- | Whether this shutdown precedes a restart.
[restartPending] :: Message -> Bool
ClearOutput :: MessageHeader -> Bool -> Message
[header] :: Message -> MessageHeader

-- | Whether to wait to redraw until there is more output.
[wait] :: Message -> Bool
RequestInput :: MessageHeader -> String -> Message
[header] :: Message -> MessageHeader
[inputPrompt] :: Message -> String
InputReply :: MessageHeader -> String -> Message
[header] :: Message -> MessageHeader
[inputValue] :: Message -> String
CommOpen :: MessageHeader -> String -> String -> UUID -> Value -> Message
[header] :: Message -> MessageHeader
[commTargetName] :: Message -> String
[commTargetModule] :: Message -> String
[commUuid] :: Message -> UUID
[commData] :: Message -> Value
CommData :: MessageHeader -> UUID -> Value -> Message
[header] :: Message -> MessageHeader
[commUuid] :: Message -> UUID
[commData] :: Message -> Value
CommClose :: MessageHeader -> UUID -> Value -> Message
[header] :: Message -> MessageHeader
[commUuid] :: Message -> UUID
[commData] :: Message -> Value
HistoryRequest :: MessageHeader -> Bool -> Bool -> HistoryAccessType -> Message
[header] :: Message -> MessageHeader

-- | If True, also return output history in the resulting dict.
[historyGetOutput] :: Message -> Bool

-- | If True, return the raw input history, else the transformed input.
[historyRaw] :: Message -> Bool

-- | What history is being requested.
[historyAccessType] :: Message -> HistoryAccessType
HistoryReply :: MessageHeader -> [HistoryReplyElement] -> Message
[header] :: Message -> MessageHeader
[historyReply] :: Message -> [HistoryReplyElement]
SendNothing :: Message

-- | A message header with some metadata.
data MessageHeader
MessageHeader :: [ByteString] -> Maybe MessageHeader -> Metadata -> UUID -> UUID -> Username -> MessageType -> MessageHeader

-- | The identifiers sent with the message.
[identifiers] :: MessageHeader -> [ByteString]

-- | The parent header, if present.
[parentHeader] :: MessageHeader -> Maybe MessageHeader

-- | A dict of metadata.
[metadata] :: MessageHeader -> Metadata

-- | A unique message UUID.
[messageId] :: MessageHeader -> UUID

-- | A unique session UUID.
[sessionId] :: MessageHeader -> UUID

-- | The user who sent this message.
[username] :: MessageHeader -> Username

-- | The message type.
[msgType] :: MessageHeader -> MessageType

-- | A username for the source of a message.
type Username = Text

-- | A metadata dictionary.
type Metadata = Map Text Text

-- | The type of a message, corresponding to IPython message types.
data MessageType
KernelInfoReplyMessage :: MessageType
KernelInfoRequestMessage :: MessageType
ExecuteInputMessage :: MessageType
ExecuteReplyMessage :: MessageType
ExecuteErrorMessage :: MessageType
ExecuteRequestMessage :: MessageType
ExecuteResultMessage :: MessageType
StatusMessage :: MessageType
StreamMessage :: MessageType
DisplayDataMessage :: MessageType
OutputMessage :: MessageType
InputMessage :: MessageType
IsCompleteRequestMessage :: MessageType
IsCompleteReplyMessage :: MessageType
CompleteRequestMessage :: MessageType
CompleteReplyMessage :: MessageType
InspectRequestMessage :: MessageType
InspectReplyMessage :: MessageType
ShutdownRequestMessage :: MessageType
ShutdownReplyMessage :: MessageType
ClearOutputMessage :: MessageType
InputRequestMessage :: MessageType
InputReplyMessage :: MessageType
CommOpenMessage :: MessageType
CommDataMessage :: MessageType
CommInfoRequestMessage :: MessageType
CommInfoReplyMessage :: MessageType
CommCloseMessage :: MessageType
HistoryRequestMessage :: MessageType
HistoryReplyMessage :: MessageType
data CodeReview
CodeComplete :: CodeReview

-- | String to be used to indent next line of input
CodeIncomplete :: String -> CodeReview
CodeInvalid :: CodeReview
CodeUnknown :: CodeReview

-- | Possible MIME types for the display data.
type Width = Int
type Height = Int

-- | Input and output streams.
data StreamType
Stdin :: StreamType
Stdout :: StreamType
Stderr :: StreamType

-- | The execution state of the kernel.
data ExecutionState
Busy :: ExecutionState
Idle :: ExecutionState
Starting :: ExecutionState

-- | Possible statuses in the execution reply messages.
data ExecuteReplyStatus
Ok :: ExecuteReplyStatus
Err :: ExecuteReplyStatus
Abort :: ExecuteReplyStatus

-- | Ways in which the frontend can request history. TODO: Implement fields
--   as described in messaging spec.
data HistoryAccessType
HistoryRange :: HistoryAccessType
HistoryTail :: HistoryAccessType
HistorySearch :: HistoryAccessType

-- | Reply to history requests.
data HistoryReplyElement
HistoryReplyElement :: Int -> Int -> Either String (String, String) -> HistoryReplyElement
[historyReplySession] :: HistoryReplyElement -> Int
[historyReplyLineNumber] :: HistoryReplyElement -> Int
[historyReplyContent] :: HistoryReplyElement -> Either String (String, String)
data LanguageInfo
LanguageInfo :: String -> String -> String -> String -> LanguageInfo

-- | The language name, e.g. "haskell"
[languageName] :: LanguageInfo -> String

-- | GHC 7.6.3
[languageVersion] :: LanguageInfo -> String

-- | .hs
[languageFileExtension] :: LanguageInfo -> String

-- | <tt>ihaskell</tt>. can be <a>null</a>
[languageCodeMirrorMode] :: LanguageInfo -> String

-- | Get the reply message type for a request message type.
replyType :: MessageType -> Maybe MessageType
showMessageType :: MessageType -> String

-- | Data for display: a string with associated MIME type.
data DisplayData
DisplayData :: MimeType -> Text -> DisplayData
data MimeType
PlainText :: MimeType
MimeHtml :: MimeType
MimePng :: Width -> Height -> MimeType
MimeJpg :: Width -> Height -> MimeType
MimeSvg :: MimeType
MimeLatex :: MimeType
MimeJavascript :: MimeType
extractPlain :: [DisplayData] -> String
instance GHC.Show.Show IHaskell.IPython.Types.Message
instance GHC.Generics.Generic IHaskell.IPython.Types.DisplayData
instance GHC.Generics.Generic IHaskell.IPython.Types.MimeType
instance GHC.Classes.Eq IHaskell.IPython.Types.MimeType
instance GHC.Show.Show IHaskell.IPython.Types.StreamType
instance GHC.Show.Show IHaskell.IPython.Types.ExecutionState
instance GHC.Show.Show IHaskell.IPython.Types.HistoryReplyElement
instance GHC.Classes.Eq IHaskell.IPython.Types.HistoryReplyElement
instance GHC.Show.Show IHaskell.IPython.Types.HistoryAccessType
instance GHC.Classes.Eq IHaskell.IPython.Types.HistoryAccessType
instance GHC.Show.Show IHaskell.IPython.Types.CodeReview
instance GHC.Classes.Eq IHaskell.IPython.Types.LanguageInfo
instance GHC.Show.Show IHaskell.IPython.Types.LanguageInfo
instance GHC.Read.Read IHaskell.IPython.Types.MessageHeader
instance GHC.Show.Show IHaskell.IPython.Types.MessageHeader
instance GHC.Classes.Eq IHaskell.IPython.Types.MessageType
instance GHC.Read.Read IHaskell.IPython.Types.MessageType
instance GHC.Show.Show IHaskell.IPython.Types.MessageType
instance GHC.Show.Show IHaskell.IPython.Types.KernelSpec
instance GHC.Classes.Eq IHaskell.IPython.Types.KernelSpec
instance GHC.Read.Read IHaskell.IPython.Types.Profile
instance GHC.Show.Show IHaskell.IPython.Types.Profile
instance GHC.Read.Read IHaskell.IPython.Types.Transport
instance GHC.Show.Show IHaskell.IPython.Types.Transport
instance GHC.Show.Show IHaskell.IPython.Types.DisplayData
instance Data.Serialize.Serialize IHaskell.IPython.Types.DisplayData
instance Data.Serialize.Serialize IHaskell.IPython.Types.MimeType
instance GHC.Show.Show IHaskell.IPython.Types.MimeType
instance GHC.Read.Read IHaskell.IPython.Types.MimeType
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Types.StreamType
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Types.ExecutionState
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Types.ExecuteReplyStatus
instance GHC.Show.Show IHaskell.IPython.Types.ExecuteReplyStatus
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.MessageHeader
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Types.MessageType
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.KernelSpec
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Types.Profile
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.Profile
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.IPython.Types.Transport
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.Transport
instance Data.Serialize.Serialize Data.Text.Internal.Text


-- | This module contains the <tt>ToJSON</tt> instance for
--   <tt>Message</tt>.
module IHaskell.IPython.Message.Writer

-- | A type that can be converted to JSON.
--   
--   Instances in general <i>must</i> specify <a>toJSON</a> and
--   <i>should</i> (but don't need to) specify <a>toEncoding</a>.
--   
--   An example type and instance:
--   
--   <pre>
--   -- Allow ourselves to write <a>Text</a> literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance <a>ToJSON</a> Coord where
--     <a>toJSON</a> (Coord x y) = <a>object</a> ["x" <a>.=</a> x, "y" <a>.=</a> y]
--   
--     <a>toEncoding</a> (Coord x y) = <tt>pairs</tt> ("x" <a>.=</a> x <a>&lt;&gt;</a> "y" <a>.=</a> y)
--   </pre>
--   
--   Instead of manually writing your <a>ToJSON</a> instance, there are two
--   options to do it automatically:
--   
--   <ul>
--   <li><a>Data.Aeson.TH</a> provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.</li>
--   <li>The compiler can provide a default generic implementation for
--   <a>toJSON</a>.</li>
--   </ul>
--   
--   To use the second, simply add a <tt>deriving <a>Generic</a></tt>
--   clause to your datatype and declare a <a>ToJSON</a> instance. If you
--   require nothing other than <a>defaultOptions</a>, it is sufficient to
--   write (and this is the only alternative where the default
--   <a>toJSON</a> implementation is sufficient):
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import <a>GHC.Generics</a>
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving <a>Generic</a>
--   
--   instance <a>ToJSON</a> Coord where
--       <a>toEncoding</a> = <a>genericToEncoding</a> <a>defaultOptions</a>
--   </pre>
--   
--   If on the other hand you wish to customize the generic decoding, you
--   have to implement both methods:
--   
--   <pre>
--   customOptions = <a>defaultOptions</a>
--                   { <a>fieldLabelModifier</a> = <a>map</a> <a>toUpper</a>
--                   }
--   
--   instance <a>ToJSON</a> Coord where
--       <a>toJSON</a>     = <a>genericToJSON</a> customOptions
--       <a>toEncoding</a> = <a>genericToEncoding</a> customOptions
--   </pre>
--   
--   Previous versions of this library only had the <a>toJSON</a> method.
--   Adding <a>toEncoding</a> had to reasons:
--   
--   <ol>
--   <li>toEncoding is more efficient for the common case that the output
--   of <a>toJSON</a> is directly serialized to a <tt>ByteString</tt>.
--   Further, expressing either method in terms of the other would be
--   non-optimal.</li>
--   <li>The choice of defaults allows a smooth transition for existing
--   users: Existing instances that do not define <a>toEncoding</a> still
--   compile and have the correct semantics. This is ensured by making the
--   default implementation of <a>toEncoding</a> use <a>toJSON</a>. This
--   produces correct results, but since it performs an intermediate
--   conversion to a <a>Value</a>, it will be less efficient than directly
--   emitting an <a>Encoding</a>. (this also means that specifying nothing
--   more than <tt>instance ToJSON Coord</tt> would be sufficient as a
--   generically decoding instance, but there probably exists no good
--   reason to not specify <a>toEncoding</a> in new instances.)</li>
--   </ol>
class ToJSON a

-- | Convert a Haskell value to a JSON-friendly intermediate type.
toJSON :: ToJSON a => a -> Value

-- | Encode a Haskell value as JSON.
--   
--   The default implementation of this method creates an intermediate
--   <a>Value</a> using <a>toJSON</a>. This provides source-level
--   compatibility for people upgrading from older versions of this
--   library, but obviously offers no performance advantage.
--   
--   To benefit from direct encoding, you <i>must</i> provide an
--   implementation for this method. The easiest way to do so is by having
--   your types implement <a>Generic</a> using the <tt>DeriveGeneric</tt>
--   extension, and then have GHC generate a method body as follows.
--   
--   <pre>
--   instance <a>ToJSON</a> Coord where
--       <a>toEncoding</a> = <a>genericToEncoding</a> <a>defaultOptions</a>
--   </pre>
toEncoding :: ToJSON a => a -> Encoding
toJSONList :: ToJSON a => [a] -> Value
toEncodingList :: ToJSON a => [a] -> Encoding
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.LanguageInfo
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.Message
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.ExecutionState
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.Types.StreamType


-- | This module is responsible for converting from low-level ByteStrings
--   obtained from the 0MQ sockets into Messages. The only exposed function
--   is <a>parseMessage</a>, which should only be used in the low-level 0MQ
--   interface.
module IHaskell.IPython.Message.Parser
parseMessage :: [ByteString] -> ByteString -> ByteString -> ByteString -> ByteString -> Message


-- | The <a>ZeroMQ</a> module abstracts away the low-level 0MQ based
--   interface with IPython, replacing it instead with a Haskell Channel
--   based interface. The <a>serveProfile</a> function takes a IPython
--   profile specification and returns the channel interface to use.
module IHaskell.IPython.ZeroMQ

-- | The channel interface to the ZeroMQ sockets. All communication is done
--   via Messages, which are encoded and decoded into a lower level form
--   before being transmitted to IPython. These channels should
--   functionally serve as high-level sockets which speak Messages instead
--   of ByteStrings.
data ZeroMQInterface
Channels :: Chan Message -> Chan Message -> Chan Message -> Chan Message -> Chan Message -> ByteString -> ZeroMQInterface

-- | A channel populated with requests from the frontend.
[shellRequestChannel] :: ZeroMQInterface -> Chan Message

-- | Writing to this channel causes a reply to be sent to the frontend.
[shellReplyChannel] :: ZeroMQInterface -> Chan Message

-- | This channel is a duplicate of the shell request channel, though using
--   a different backend socket.
[controlRequestChannel] :: ZeroMQInterface -> Chan Message

-- | This channel is a duplicate of the shell reply channel, though using a
--   different backend socket.
[controlReplyChannel] :: ZeroMQInterface -> Chan Message

-- | Writing to this channel sends an iopub message to the frontend.
[iopubChannel] :: ZeroMQInterface -> Chan Message

-- | Key used to sign messages.
[hmacKey] :: ZeroMQInterface -> ByteString
data ZeroMQStdin
StdinChannel :: Chan Message -> Chan Message -> ZeroMQStdin
[stdinRequestChannel] :: ZeroMQStdin -> Chan Message
[stdinReplyChannel] :: ZeroMQStdin -> Chan Message

-- | Start responding on all ZeroMQ channels used to communicate with
--   IPython | via the provided profile. Return a set of channels which can
--   be used to | communicate with IPython in a more structured manner.
serveProfile :: Profile -> Bool -> IO ZeroMQInterface
serveStdin :: Profile -> IO ZeroMQStdin

-- | Describes ports used when creating an ephemeral ZeroMQ session. Used
--   to generate the ipython JSON config file.
data ZeroMQEphemeralPorts

-- | Run session for communicating with an IPython instance on ephemerally
--   allocated ZMQ4 sockets. The sockets will be closed when the callback
--   returns.
withEphemeralPorts :: ByteString -> Bool -> (ZeroMQEphemeralPorts -> ZeroMQInterface -> IO a) -> IO a
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.IPython.ZeroMQ.ZeroMQEphemeralPorts


-- | This module exports all the types and functions necessary to create an
--   IPython language kernel that supports the <tt>ipython console</tt> and
--   <tt>ipython notebook</tt> frontends.
module IHaskell.IPython.Kernel


-- | simple IPython kernels. In particular, it provides a record type that
--   defines configurations and a function that interprets a configuration
--   as an action in some monad that can do IO.
--   
--   The configuration consists primarily of functions that implement the
--   various features of a kernel, such as running code, looking up
--   documentation, and performing completion. An example for a simple
--   language that nevertheless has side effects, global state, and timing
--   effects is included in the examples directory.
--   
--   <h1>Kernel Specs</h1>
--   
--   To run your kernel, you will need to install the kernelspec into the
--   Jupyter namespace. If your kernel name is <tt>kernel</tt>, you will
--   need to run the command:
--   
--   <pre>
--   kernel install
--   </pre>
--   
--   This will inform Jupyter of the kernel so that it may be used.
--   
--   <h2>Further profile improvements Consult the IPython documentation
--   along with the generated</h2>
--   
--   profile source code for further configuration of the frontend,
--   including syntax highlighting, logos, help text, and so forth.
module IHaskell.IPython.EasyKernel

-- | Execute an IPython kernel for a config. Your <tt>main</tt> action
--   should call this as the last thing it does.
easyKernel :: MonadIO m => FilePath -> KernelConfig m output result -> m ()
installKernelspec :: MonadIO m => KernelConfig m output result -> Bool -> Maybe FilePath -> m ()

-- | The kernel configuration specifies the behavior that is specific to
--   your language. The type parameters provide the monad in which your
--   kernel will run, the type of intermediate outputs from running cells,
--   and the type of final results of cells, respectively.
data KernelConfig m output result
KernelConfig :: LanguageInfo -> (FilePath -> IO KernelSpec) -> (output -> [DisplayData]) -> (result -> [DisplayData]) -> (Text -> Int -> m (Text, [Text])) -> (Text -> Int -> m (Maybe [DisplayData])) -> (Text -> IO () -> (output -> IO ()) -> m (result, ExecuteReplyStatus, String)) -> Bool -> String -> String -> String -> String -> KernelConfig m output result

-- | Info on the language of the kernel.
[kernelLanguageInfo] :: KernelConfig m output result -> LanguageInfo

-- | Write all the files into the kernel directory, including `kernel.js`,
--   `logo-64x64.png`, and any other required files. The directory to write
--   to will be passed to this function, and the return value should be the
--   kernelspec to be written to `kernel.json`.
[writeKernelspec] :: KernelConfig m output result -> FilePath -> IO KernelSpec

-- | How to render intermediate output
[displayOutput] :: KernelConfig m output result -> output -> [DisplayData]

-- | How to render final cell results
[displayResult] :: KernelConfig m output result -> result -> [DisplayData]

-- | Perform completion. The returned tuple consists of the matched text
--   and completions. The arguments are the code in the cell and the
--   position of the cursor in the cell.
[completion] :: KernelConfig m output result -> Text -> Int -> m (Text, [Text])

-- | Return the information or documentation for its argument, described by
--   the cell contents and cursor position. The returned value is simply
--   the data to display.
[inspectInfo] :: KernelConfig m output result -> Text -> Int -> m (Maybe [DisplayData])

-- | Execute a cell. The arguments are the contents of the cell, an IO
--   action that will clear the current intermediate output, and an IO
--   action that will add a new item to the intermediate output. The result
--   consists of the actual result, the status to be sent to IPython, and
--   the contents of the pager. Return the empty string to indicate that
--   there is no pager output. Errors should be handled by defining an
--   appropriate error constructor in your result type.
[run] :: KernelConfig m output result -> Text -> IO () -> (output -> IO ()) -> m (result, ExecuteReplyStatus, String)

-- | Whether to print extra debugging information to | A One-line
--   description of the kernel
[debug] :: KernelConfig m output result -> Bool
[kernelBanner] :: KernelConfig m output result -> String

-- | The version of the messaging specification used by the kernel
[kernelProtocolVersion] :: KernelConfig m output result -> String

-- | Name of the kernel implementation
[kernelImplName] :: KernelConfig m output result -> String

-- | Version of the kernel implementation
[kernelImplVersion] :: KernelConfig m output result -> String
