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


-- | A Haskell backend kernel for the IPython project.
--   
--   IHaskell is a Haskell backend kernel for the IPython project. This
--   allows using Haskell via a console or notebook interface. Additional
--   packages may be installed to provide richer data visualizations.
@package ihaskell
@version 0.9.0.3


module IHaskell.Types

-- | 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

-- | 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

-- | Duplicate a message header, giving it a new UUID and message type.
dupHeader :: MessageHeader -> MessageType -> IO MessageHeader

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

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

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

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

-- | Input and output streams.
data StreamType :: *
Stdin :: StreamType
Stdout :: StreamType
Stderr :: StreamType
data MimeType :: *
PlainText :: MimeType
MimeHtml :: MimeType
MimePng :: Width -> Height -> MimeType
MimeJpg :: Width -> Height -> MimeType
MimeSvg :: MimeType
MimeLatex :: MimeType
MimeJavascript :: MimeType

-- | Data for display: a string with associated MIME type.
data DisplayData :: *
DisplayData :: MimeType -> Text -> DisplayData

-- | Output of evaluation.
data EvaluationResult

-- | An intermediate result which communicates what has been printed thus
--   far.
IntermediateResult :: Display -> EvaluationResult

-- | Display outputs.
[outputs] :: EvaluationResult -> Display
FinalResult :: Display -> [DisplayData] -> [WidgetMsg] -> EvaluationResult

-- | Display outputs.
[outputs] :: EvaluationResult -> Display

-- | Mimebundles to display in the IPython pager.
[pagerOut] :: EvaluationResult -> [DisplayData]

-- | Comm operations
[commMsgs] :: EvaluationResult -> [WidgetMsg]

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

-- | All state stored in the kernel between executions.
data KernelState
KernelState :: Int -> LintStatus -> Bool -> Bool -> Bool -> Bool -> Map UUID Widget -> Bool -> Bool -> KernelState
[getExecutionCounter] :: KernelState -> Int
[getLintStatus] :: KernelState -> LintStatus
[useSvg] :: KernelState -> Bool
[useShowErrors] :: KernelState -> Bool
[useShowTypes] :: KernelState -> Bool
[usePager] :: KernelState -> Bool
[openComms] :: KernelState -> Map UUID Widget
[kernelDebug] :: KernelState -> Bool
[supportLibrariesAvailable] :: KernelState -> Bool

-- | Current HLint status.
data LintStatus
LintOn :: LintStatus
LintOff :: LintStatus

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

-- | Wrapper for ipython-kernel's DisplayData which allows sending multiple
--   results from the same expression.
data Display
Display :: [DisplayData] -> Display
ManyDisplay :: [Display] -> Display
defaultKernelState :: KernelState
extractPlain :: [DisplayData] -> String
kernelOpts :: [KernelOpt]

-- | Kernel options to be set via `:set` and `:option`.
data KernelOpt
KernelOpt :: [String] -> [String] -> (KernelState -> KernelState) -> KernelOpt

-- | Ways to set this option via `:option`
[getOptionName] :: KernelOpt -> [String]

-- | Ways to set this option via `:set`
[getSetName] :: KernelOpt -> [String]

-- | Function to update the kernel state.
[getUpdateKernelState] :: KernelOpt -> KernelState -> KernelState

-- | A class for displayable Haskell types.
--   
--   IHaskell's displaying of results behaves as if these two
--   overlapping/undecidable instances also existed:
--   
--   <pre>
--   instance (Show a) =&gt; IHaskellDisplay a
--   instance Show a where shows _ = id
--   </pre>
class IHaskellDisplay a
display :: IHaskellDisplay a => a -> IO Display

-- | Display as an interactive widget.
class IHaskellDisplay a => IHaskellWidget a

-- | Target name for this widget. The actual input parameter should be
--   ignored. By default evaluate to "jupyter.widget", which is used by
--   IPython for its backbone widgets.
targetName :: IHaskellWidget a => a -> String

-- | Target module for this widget. Evaluates to an empty string by
--   default.
targetModule :: IHaskellWidget a => a -> String

-- | Get the uuid for comm associated with this widget. The widget is
--   responsible for storing the UUID during initialization.
getCommUUID :: IHaskellWidget a => a -> UUID

-- | Called when the comm is opened. Allows additional messages to be sent
--   after comm open.
open :: IHaskellWidget a => a -> (Value -> IO ()) -> IO ()

-- | Respond to a comm data message. Called when a message is recieved on
--   the comm associated with the widget.
comm :: IHaskellWidget a => a -> Value -> (Value -> IO ()) -> IO ()

-- | Called when a comm_close is recieved from the frontend.
close :: IHaskellWidget a => a -> Value -> IO ()
data Widget
Widget :: a -> Widget

-- | Send JSON objects with specific formats
data WidgetMsg

-- | Cause the interpreter to open a new comm, and register the associated
--   widget in the kernelState. Also sends an initial state Value with
--   comm_open.
Open :: Widget -> Value -> WidgetMsg

-- | Cause the interpreter to send a comm_msg containing a state update for
--   the widget. Can be used to send fragments of state for update. Also
--   updates the value of widget stored in the kernelState
Update :: Widget -> Value -> WidgetMsg

-- | Cause the interpreter to send a comm_msg containing a display command
--   for the frontend.
View :: Widget -> WidgetMsg

-- | Cause the interpreter to close the comm associated with the widget.
--   Also sends data with comm_close.
Close :: Widget -> Value -> WidgetMsg

-- | A [method .= custom, content = value] message
Custom :: Widget -> Value -> WidgetMsg

-- | A json object that is sent to the widget without modifications.
JSONValue :: Widget -> Value -> WidgetMsg

-- | A <tt>display_data</tt> message, sent as a [method .= custom] comm_msg
DispMsg :: Widget -> Display -> WidgetMsg

-- | A <tt>clear_output</tt> message, sent as a [method .= custom] comm_msg
ClrOutput :: Widget -> Bool -> WidgetMsg
data WidgetMethod
UpdateState :: Value -> WidgetMethod
CustomContent :: Value -> WidgetMethod
DisplayWidget :: WidgetMethod
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]
instance GHC.Show.Show IHaskell.Types.EvaluationResult
instance GHC.Show.Show IHaskell.Types.WidgetMsg
instance GHC.Show.Show IHaskell.Types.KernelState
instance GHC.Show.Show IHaskell.Types.LintStatus
instance GHC.Classes.Eq IHaskell.Types.LintStatus
instance GHC.Generics.Generic IHaskell.Types.Display
instance GHC.Show.Show IHaskell.Types.Display
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.Types.WidgetMethod
instance IHaskell.Types.IHaskellDisplay IHaskell.Types.Widget
instance IHaskell.Types.IHaskellWidget IHaskell.Types.Widget
instance GHC.Show.Show IHaskell.Types.Widget
instance GHC.Classes.Eq IHaskell.Types.Widget
instance Data.Serialize.Serialize IHaskell.Types.Display
instance Data.Semigroup.Semigroup IHaskell.Types.Display
instance GHC.Base.Monoid IHaskell.Types.Display


-- | This module provides a way in which the Haskell standard input may be
--   forwarded to the IPython frontend and thus allows the notebook to use
--   the standard input.
--   
--   This relies on the implementation of file handles in GHC, and is
--   generally unsafe and terrible. However, it is difficult to find
--   another way to do it, as file handles are generally meant to point to
--   streams and files, and not networked communication protocols.
--   
--   In order to use this module, it must first be initialized with two
--   things. First of all, in order to know how to communicate with the
--   IPython frontend, it must know the kernel profile used for
--   communication. For this, use <tt>recordKernelProfile</tt> once the
--   profile is known. Both this and <tt>recordParentHeader</tt> take a
--   directory name where they can store this data.
--   
--   Finally, the module must know what <tt>execute_request</tt> message is
--   currently being replied to (which will request the input). Thus, every
--   time the language kernel receives an <tt>execute_request</tt> message,
--   it should inform this module via <tt>recordParentHeader</tt>, so that
--   the module may generate messages with an appropriate parent header
--   set. If this is not done, the IPython frontends will not recognize the
--   target of the communication.
--   
--   Finally, in order to activate this module, <tt>fixStdin</tt> must be
--   called once. It must be passed the same directory name as
--   <tt>recordParentHeader</tt> and <tt>recordKernelProfile</tt>. Note
--   that if this is being used from within the GHC API, <tt>fixStdin</tt>
--   <i>must</i> be called from within the GHC session not from the host
--   code.
module IHaskell.IPython.Stdin

-- | Manipulate standard input so that it is sourced from the IPython
--   frontend. This function is build on layers of deep magical hackery, so
--   be careful modifying it.
fixStdin :: String -> IO ()
recordParentHeader :: String -> MessageHeader -> IO ()
recordKernelProfile :: String -> Profile -> IO ()

module IHaskell.Flags
data IHaskellMode
ShowDefault :: String -> IHaskellMode
InstallKernelSpec :: IHaskellMode
ConvertLhs :: IHaskellMode
Kernel :: (Maybe String) -> IHaskellMode
data Argument

-- | A file with commands to load at startup.
ConfFile :: String -> Argument

-- | Present when output should overwrite existing files.
OverwriteFiles :: Argument

-- | Where to find the GHC libraries.
GhcLibDir :: String -> Argument

-- | Options for the GHC runtime (e.g. heap-size limit or number of
--   threads).
RTSFlags :: [String] -> Argument

-- | Spew debugging output from the kernel.
KernelDebug :: Argument

-- | Display help text.
Help :: Argument

-- | Display version text.
Version :: Argument
ConvertFrom :: String -> Argument
ConvertTo :: String -> Argument
ConvertFromFormat :: NotebookFormat -> Argument
ConvertToFormat :: NotebookFormat -> Argument
ConvertLhsStyle :: (LhsStyle String) -> Argument
KernelspecInstallPrefix :: String -> Argument
KernelspecUseStack :: Argument
data Args
Args :: IHaskellMode -> [Argument] -> Args
data LhsStyle string
LhsStyle :: string -> string -> string -> string -> string -> string -> LhsStyle string

-- | <pre>
--   &gt;
--   </pre>
[lhsCodePrefix] :: LhsStyle string -> string

-- | <pre>
--   &lt;&lt;
--   </pre>
[lhsOutputPrefix] :: LhsStyle string -> string

-- | <pre>
--   \begin{code}
--   </pre>
[lhsBeginCode] :: LhsStyle string -> string

-- | <pre>
--   \end{code}
--   </pre>
[lhsEndCode] :: LhsStyle string -> string

-- | <pre>
--   \begin{verbatim}
--   </pre>
[lhsBeginOutput] :: LhsStyle string -> string

-- | <pre>
--   \end{verbatim}
--   </pre>
[lhsEndOutput] :: LhsStyle string -> string
data NotebookFormat
LhsMarkdown :: NotebookFormat
IpynbFile :: NotebookFormat
lhsStyleBird :: LhsStyle String

-- | Given a list of command-line arguments, return the IHaskell mode and
--   arguments to process.
parseFlags :: [String] -> Either String Args

-- | Get help text for a given IHaskell ode.
help :: IHaskellMode -> String
instance GHC.Show.Show IHaskell.Flags.Args
instance GHC.Show.Show IHaskell.Flags.IHaskellMode
instance GHC.Classes.Eq IHaskell.Flags.IHaskellMode
instance GHC.Show.Show IHaskell.Flags.Argument
instance GHC.Classes.Eq IHaskell.Flags.Argument
instance GHC.Show.Show IHaskell.Flags.NotebookFormat
instance GHC.Classes.Eq IHaskell.Flags.NotebookFormat
instance GHC.Show.Show string => GHC.Show.Show (IHaskell.Flags.LhsStyle string)
instance GHC.Base.Functor IHaskell.Flags.LhsStyle
instance GHC.Classes.Eq string => GHC.Classes.Eq (IHaskell.Flags.LhsStyle string)


-- | This module splits a shell command line into a list of strings, one
--   for each command / filename
module IHaskell.Eval.ParseShell
parseShell :: String -> Either ParseError [String]

module IHaskell.Convert.LhsToIpynb
lhsToIpynb :: LhsStyle LText -> FilePath -> FilePath -> IO ()
instance GHC.Show.Show a => GHC.Show.Show (IHaskell.Convert.LhsToIpynb.Cell a)
instance GHC.Show.Show a => GHC.Show.Show (IHaskell.Convert.LhsToIpynb.CellLine a)

module IHaskell.Convert.IpynbToLhs
ipynbToLhs :: LhsStyle LText -> FilePath -> FilePath -> IO ()


module IHaskell.Convert.Args

-- | ConvertSpec is the accumulator for command line arguments
data ConvertSpec f
ConvertSpec :: f Bool -> f FilePath -> f FilePath -> f (LhsStyle Text) -> Bool -> ConvertSpec f
[convertToIpynb] :: ConvertSpec f -> f Bool
[convertInput] :: ConvertSpec f -> f FilePath
[convertOutput] :: ConvertSpec f -> f FilePath
[convertLhsStyle] :: ConvertSpec f -> f (LhsStyle Text)
[convertOverwriteFiles] :: ConvertSpec f -> Bool

-- | Convert a possibly-incomplete specification for what to convert into
--   one which can be executed. Calls error when data is missing.
fromJustConvertSpec :: ConvertSpec Maybe -> ConvertSpec Identity
toConvertSpec :: [Argument] -> ConvertSpec Maybe


module IHaskell.Convert

-- | used by <tt>IHaskell convert</tt>
convert :: [Argument] -> IO ()

module IHaskell.CSS
ihaskellCSS :: String

module IHaskell.BrokenPackages

-- | Get a list of broken packages. This function internally shells out to
--   `ghc-pkg`, and parses the output in order to determine what packages
--   are broken.
getBrokenPackages :: IO [String]
instance GHC.Show.Show IHaskell.BrokenPackages.BrokenPackage

module Paths_ihaskell
version :: Version
getBinDir :: IO FilePath
getLibDir :: IO FilePath
getDynLibDir :: IO FilePath
getDataDir :: IO FilePath
getLibexecDir :: IO FilePath
getDataFileName :: FilePath -> IO FilePath
getSysconfDir :: IO FilePath


module IHaskell.IPython
replaceIPythonKernelspec :: KernelSpecOptions -> IO ()
defaultConfFile :: IO (Maybe String)
getIHaskellDir :: IO String
getSandboxPackageConf :: IO (Maybe String)

-- | Replace "~" with $HOME if $HOME is defined. Otherwise, do nothing.
subHome :: String -> IO String

-- | The IPython kernel name.
kernelName :: String
data KernelSpecOptions
KernelSpecOptions :: String -> [String] -> Bool -> IO (Maybe String) -> Maybe String -> Bool -> KernelSpecOptions

-- | GHC libdir.
[kernelSpecGhcLibdir] :: KernelSpecOptions -> String

-- | Runtime options to use.
[kernelSpecRTSOptions] :: KernelSpecOptions -> [String]

-- | Spew debugging output?
[kernelSpecDebug] :: KernelSpecOptions -> Bool

-- | Filename of profile JSON file.
[kernelSpecConfFile] :: KernelSpecOptions -> IO (Maybe String)
[kernelSpecInstallPrefix] :: KernelSpecOptions -> Maybe String

-- | Whether to use <tt>stack</tt> environments.
[kernelSpecUseStack] :: KernelSpecOptions -> Bool
defaultKernelSpecOptions :: KernelSpecOptions

module IHaskell.Eval.Util

-- | Initialize the GHC API. Run this as the first thing in the
--   <a>runGhc</a>. This initializes some dyn flags
--   (<tt>ExtendedDefaultRules</tt>, <tt>NoMonomorphismRestriction</tt>),
--   sets the target to interpreted, link in memory, sets a reasonable
--   output width, and potentially a few other things. It should be invoked
--   before other functions from this module.
--   
--   We also require that the sandbox PackageConf (if any) is passed here
--   as setSessionDynFlags will read the package database the first time
--   (and only the first time) it is called.
initGhci :: GhcMonad m => Maybe String -> m ()

-- | Find the extension that corresponds to a given flag. Create the
--   corresponding <a>ExtFlag</a> via <tt>SetFlag</tt> or
--   <tt>UnsetFlag</tt>. If no such extension exist, yield
--   <tt>Nothing</tt>.
extensionFlag :: String -> Maybe ExtFlag

-- | Set an extension and update flags. Return <tt>Nothing</tt> on success.
--   On failure, return an error message.
setExtension :: GhcMonad m => String -> m (Maybe String)

-- | A extension flag that can be set or unset.
data ExtFlag
SetFlag :: ExtensionFlag -> ExtFlag
UnsetFlag :: ExtensionFlag -> ExtFlag

-- | Set a list of flags, as per GHCi's `:set`. This was adapted from GHC's
--   InteractiveUI.hs (newDynFlags). It returns a list of error messages.
setFlags :: GhcMonad m => [String] -> m [String]

-- | Evaluate a single import statement. If this import statement is
--   importing a module which was previously imported implicitly (such as
--   <tt>Prelude</tt>) or if this module has a <tt>hiding</tt> annotation,
--   the previous import is removed.
evalImport :: GhcMonad m => String -> m ()
removeImport :: GhcMonad m => String -> m ()

-- | Evaluate a series of declarations. Return all names which were bound
--   by these declarations.
evalDeclarations :: GhcMonad m => String -> m [String]

-- | Get the type of an expression and convert it to a string.
getType :: GhcMonad m => String -> m String

-- | A wrapper around <tt>getInfo</tt>. Return info about each name in the
--   string.
getDescription :: GhcMonad m => String -> m [String]

-- | Convert an <tt>SDoc</tt> into a string. This is similar to the family
--   of <tt>showSDoc</tt> functions, but does not impose an arbitrary width
--   limit on the output (in terms of number of columns). Instead, it
--   respsects the <a>pprCols</a> field in the structure returned by
--   <a>getSessionDynFlags</a>, and thus gives a configurable width of
--   output.
doc :: GhcMonad m => SDoc -> m String

-- | Pretty-print dynamic flags (taken from <tt>InteractiveUI</tt> module
--   of `ghc-bin`)
pprDynFlags :: Bool -> DynFlags -> SDoc

-- | Pretty-print the base language and active options (taken from
--   <tt>InteractiveUI</tt> module of `ghc-bin`)
pprLanguages :: Bool -> DynFlags -> SDoc

-- | This is unfoldM from monad-loops. It repeatedly runs an IO action
--   until it return Nothing, and puts all the Justs in a list. If you find
--   yourself using more functionality from monad-loops, just add the
--   package dependency instead of copying more code from it.
unfoldM :: IO (Maybe a) -> IO [a]

module IHaskell.Eval.Parser

-- | Parse a string into code blocks.
parseString :: String -> Ghc [Located CodeBlock]

-- | A block of code to be evaluated. Each block contains a single element
--   - one declaration, statement, expression, etc. If parsing of the block
--   failed, the block is instead a ParseError, which has the error
--   location and error message.
data CodeBlock

-- | A Haskell expression.
Expression :: String -> CodeBlock

-- | A data type or function declaration.
Declaration :: String -> CodeBlock

-- | A Haskell statement (as if in a `do` block).
Statement :: String -> CodeBlock

-- | An import statement.
Import :: String -> CodeBlock

-- | A lonely type signature (not above a function declaration).
TypeSignature :: String -> CodeBlock

-- | An IHaskell directive.
Directive :: DirectiveType -> String -> CodeBlock

-- | A full Haskell module, to be compiled and loaded.
Module :: String -> CodeBlock

-- | An error indicating that parsing the code block failed.
ParseError :: StringLoc -> ErrMsg -> CodeBlock

-- | A list of GHC pragmas (from a {--} block)
Pragma :: PragmaType -> [String] -> CodeBlock

-- | A location in an input string.
data StringLoc :: *
Loc :: LineNumber -> ColumnNumber -> StringLoc

-- | Directive types. Each directive is associated with a string in the
--   directive code block.
data DirectiveType

-- | Get the type of an expression via ':type' (or unique prefixes)
GetType :: DirectiveType

-- | Get info about the identifier via ':info' (or unique prefixes)
GetInfo :: DirectiveType

-- | Enable or disable an extensions, packages etc. via `:set`. Emulates
--   GHCi's `:set`
SetDynFlag :: DirectiveType

-- | Load a Haskell module.
LoadFile :: DirectiveType

-- | Set IHaskell kernel option `:option`.
SetOption :: DirectiveType

-- | `:extension Foo` is a shortcut for `:set -XFoo`
SetExtension :: DirectiveType

-- | Execute a shell command.
ShellCmd :: DirectiveType

-- | General help via <tt>:?</tt> or ':help'.
GetHelp :: DirectiveType

-- | Search for something via Hoogle.
SearchHoogle :: DirectiveType

-- | Get documentation for an identifier via Hoogle.
GetDoc :: DirectiveType

-- | Get the kind of a type via ':kind'.
GetKind :: DirectiveType

-- | Load and unload modules via ':module'.
LoadModule :: DirectiveType

-- | A line number in an input string.
type LineNumber = Int

-- | A column number in an input string.
type ColumnNumber = Int

-- | An error message string.
type ErrMsg = String

-- | Split an input string into chunks based on indentation. A chunk is a
--   line and all lines immediately following that are indented beyond the
--   indentation of the first line. This parses Haskell layout rules
--   properly, and allows using multiline expressions via indentation.
--   
--   Quasiquotes are allowed via a post-processing step.
layoutChunks :: String -> [Located String]

-- | Parse a directive of the form :directiveName.
parseDirective :: String -> Int -> CodeBlock

-- | Parse a module and return the name declared in the 'module X where'
--   line. That line is required, and if it does not exist, this will
--   error. Names with periods in them are returned piece by piece.
getModuleName :: GhcMonad m => String -> m [String]

-- | Store locations along with a value.
data Located a :: * -> *
Located :: LineNumber -> a -> Located a
[line] :: Located a -> LineNumber
[unloc] :: Located a -> a

-- | Pragma types. Only LANGUAGE pragmas are currently supported. Other
--   pragma types are kept around as a string for error reporting.
data PragmaType
PragmaLanguage :: PragmaType
PragmaUnsupported :: String -> PragmaType
instance GHC.Classes.Eq IHaskell.Eval.Parser.CodeBlock
instance GHC.Show.Show IHaskell.Eval.Parser.CodeBlock
instance GHC.Classes.Eq IHaskell.Eval.Parser.PragmaType
instance GHC.Show.Show IHaskell.Eval.Parser.PragmaType
instance GHC.Classes.Eq IHaskell.Eval.Parser.DirectiveType
instance GHC.Show.Show IHaskell.Eval.Parser.DirectiveType

module IHaskell.Eval.Hoogle

-- | Search for a query on Hoogle. Return all search results.
search :: String -> IO [HoogleResult]

-- | Look up an identifier on Hoogle. Return documentation for that
--   identifier. If there are many identifiers, include documentation for
--   all of them.
document :: String -> IO [HoogleResult]

-- | Render a Hoogle search result into an output format.
render :: OutputFormat -> HoogleResult -> String

-- | Types of formats to render output to.
data OutputFormat

-- | Render to plain text.
Plain :: OutputFormat

-- | Render to HTML.
HTML :: OutputFormat
data HoogleResult
instance GHC.Show.Show IHaskell.Eval.Hoogle.HoogleResult
instance GHC.Show.Show IHaskell.Eval.Hoogle.HoogleResponse
instance GHC.Classes.Eq IHaskell.Eval.Hoogle.HoogleResponse
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.Eval.Hoogle.HoogleResponseList
instance Data.Aeson.Types.FromJSON.FromJSON IHaskell.Eval.Hoogle.HoogleResponse


-- | If you are interested in the IHaskell library for the purpose of
--   augmenting the IHaskell notebook or writing your own display
--   mechanisms and widgets, this module contains all functions you need.
--   
--   In order to create a display mechanism for a particular data type,
--   write a module named (for example) <tt>IHaskell.Display.YourThing</tt>
--   in a package named <tt>ihaskell-yourThing</tt>. (Note the
--   capitalization - it's important!) Then, in that module, add an
--   instance of <tt>IHaskellDisplay</tt> for your data type. Similarly, to
--   create a widget, add an instance of <tt>IHaskellWidget</tt>.
--   
--   An example of creating a display is provided in the <a>demo
--   notebook</a>.
module IHaskell.Display

-- | A class for displayable Haskell types.
--   
--   IHaskell's displaying of results behaves as if these two
--   overlapping/undecidable instances also existed:
--   
--   <pre>
--   instance (Show a) =&gt; IHaskellDisplay a
--   instance Show a where shows _ = id
--   </pre>
class IHaskellDisplay a
display :: IHaskellDisplay a => a -> IO Display

-- | Wrapper for ipython-kernel's DisplayData which allows sending multiple
--   results from the same expression.
data Display
Display :: [DisplayData] -> Display
ManyDisplay :: [Display] -> Display

-- | Data for display: a string with associated MIME type.
data DisplayData :: *
DisplayData :: MimeType -> Text -> DisplayData

-- | Display as an interactive widget.
class IHaskellDisplay a => IHaskellWidget a

-- | Target name for this widget. The actual input parameter should be
--   ignored. By default evaluate to "jupyter.widget", which is used by
--   IPython for its backbone widgets.
targetName :: IHaskellWidget a => a -> String

-- | Target module for this widget. Evaluates to an empty string by
--   default.
targetModule :: IHaskellWidget a => a -> String

-- | Get the uuid for comm associated with this widget. The widget is
--   responsible for storing the UUID during initialization.
getCommUUID :: IHaskellWidget a => a -> UUID

-- | Called when the comm is opened. Allows additional messages to be sent
--   after comm open.
open :: IHaskellWidget a => a -> (Value -> IO ()) -> IO ()

-- | Respond to a comm data message. Called when a message is recieved on
--   the comm associated with the widget.
comm :: IHaskellWidget a => a -> Value -> (Value -> IO ()) -> IO ()

-- | Called when a comm_close is recieved from the frontend.
close :: IHaskellWidget a => a -> Value -> IO ()

-- | Write to the display channel. The contents will be displayed in the
--   notebook once the current execution call ends.
printDisplay :: IHaskellDisplay a => a -> IO ()

-- | Generate a plain text display.
plain :: String -> DisplayData

-- | Generate an HTML display.
html :: String -> DisplayData

-- | Generate a PNG display of the given width and height. Data must be
--   provided in a Base64 encoded manner, suitable for embedding into HTML.
--   The <tt>base64</tt> function may be used to encode data into this
--   format.
png :: Width -> Height -> Base64 -> DisplayData

-- | Generate a JPG display of the given width and height. Data must be
--   provided in a Base64 encoded manner, suitable for embedding into HTML.
--   The <tt>base64</tt> function may be used to encode data into this
--   format.
jpg :: Width -> Height -> Base64 -> DisplayData

-- | Generate an SVG display.
svg :: String -> DisplayData

-- | Generate a LaTeX display.
latex :: String -> DisplayData

-- | Generate a Javascript display.
javascript :: String -> DisplayData

-- | Encode many displays into a single one. All will be output.
many :: [Display] -> Display

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

-- | Convert from a string into base 64 encoded data.
encode64 :: String -> Base64

-- | Convert from a ByteString into base 64 encoded data.
base64 :: ByteString -> Base64

-- | Convenience function for client libraries. Switch to a temporary
--   directory so that any files we create aren't visible. On Unix, this is
--   usually /tmp.
switchToTmpDir :: IO ()

-- | Take everything that was put into the <a>displayChan</a> at that point
--   out, and make a <a>Display</a> out of it.
displayFromChanEncoded :: IO ByteString

-- | For internal use within IHaskell. Serialize displays to a ByteString.
serializeDisplay :: Display -> ByteString
data Widget
Widget :: a -> Widget
instance IHaskell.Types.IHaskellDisplay a => IHaskell.Types.IHaskellDisplay (GHC.Types.IO a)
instance IHaskell.Types.IHaskellDisplay IHaskell.Types.Display
instance IHaskell.Types.IHaskellDisplay IHaskell.IPython.Types.DisplayData
instance IHaskell.Types.IHaskellDisplay a => IHaskell.Types.IHaskellDisplay [a]

module IHaskell.Publish

-- | Publish evaluation results, ignore any CommMsgs. This function can be
--   used to create a function of type (EvaluationResult -&gt; IO ()),
--   which can be used to publish results to the frontend. The resultant
--   function shares some state between different calls by storing it
--   inside the MVars passed while creating it using this function. Pager
--   output is accumulated in the MVar passed for this purpose if a pager
--   is being used (indicated by an argument), and sent to the frontend
--   otherwise.
publishResult :: (Message -> IO ()) -> MessageHeader -> MVar [Display] -> MVar Bool -> MVar [DisplayData] -> Bool -> EvaluationResult -> IO ()

module IHaskell.Eval.Widgets

-- | Send a message to open a comm
widgetSendOpen :: IHaskellWidget a => a -> Value -> IO ()

-- | Send a [method .= display] comm_msg
widgetSendView :: IHaskellWidget a => a -> IO ()

-- | Send a state update message
widgetSendUpdate :: IHaskellWidget a => a -> Value -> IO ()

-- | Send a [method .= custom, content .= value] comm_msg
widgetSendCustom :: IHaskellWidget a => a -> Value -> IO ()

-- | Send a comm_close
widgetSendClose :: IHaskellWidget a => a -> Value -> IO ()

-- | Send a custom Value
widgetSendValue :: IHaskellWidget a => a -> Value -> IO ()

-- | Send a <tt>display_data</tt> message as a [method .= custom] message
widgetPublishDisplay :: (IHaskellWidget a, IHaskellDisplay b) => a -> b -> IO ()

-- | Send a <tt>clear_output</tt> message as a [method .= custom] message
widgetClearOutput :: IHaskellWidget a => a -> Bool -> IO ()

-- | Return all pending comm_close messages
relayWidgetMessages :: IO [WidgetMsg]
widgetHandler :: (Message -> IO ()) -> MessageHeader -> KernelState -> [WidgetMsg] -> IO KernelState
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.Eval.Widgets.WidgetDisplay
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.Eval.Widgets.WidgetClear
instance Data.Aeson.Types.ToJSON.ToJSON IHaskell.Eval.Widgets.IPythonMessage

module IHaskell.Eval.Lint

-- | Given parsed code chunks, perform linting and output a displayable
--   report on linting warnings and errors.
lint :: [Located CodeBlock] -> IO Display
instance GHC.Show.Show IHaskell.Eval.Lint.LintSuggestion
instance GHC.Classes.Eq IHaskell.Eval.Lint.LintSuggestion


-- | This module exports all functions used for evaluation of IHaskell
--   input.
module IHaskell.Eval.Evaluate

-- | Run an interpreting action. This is effectively runGhc with
--   initialization and importing. First argument indicates whether
--   <a>stdin</a> is handled specially, which cannot be done in a testing
--   environment. The argument passed to the action indicates whether
--   Haskell support libraries are available.
interpret :: String -> Bool -> (Bool -> Interpreter a) -> IO a

-- | Interpreting function for testing.
testInterpret :: Interpreter a -> IO a

-- | Evaluation function for testing.
testEvaluate :: String -> IO ()

-- | Evaluate some IPython input code.
evaluate :: KernelState -> String -> Publisher -> (KernelState -> [WidgetMsg] -> IO KernelState) -> Interpreter KernelState
flushWidgetMessages :: KernelState -> [WidgetMsg] -> (KernelState -> [WidgetMsg] -> IO KernelState) -> Interpreter KernelState
type Interpreter = Ghc

-- | Lift a computation from the <a>IO</a> monad.
liftIO :: MonadIO m => forall a. () => IO a -> m a
typeCleaner :: String -> String
formatType :: String -> Display
capturedIO :: Publisher -> KernelState -> IO a -> Interpreter Display
instance GHC.Classes.Eq IHaskell.Eval.Evaluate.ErrorOccurred
instance GHC.Show.Show IHaskell.Eval.Evaluate.ErrorOccurred


module IHaskell.Eval.Inspect
inspect :: String -> Int -> Interpreter (Maybe Display)


module IHaskell.Eval.Info
info :: String -> Interpreter String


-- | This has a limited amount of context sensitivity. It distinguishes
--   between four contexts at the moment: - import statements (completed
--   using modules) - identifiers (completed using in scope values) -
--   extensions via :ext (completed using GHC extensions) - qualified
--   identifiers (completed using in-scope values)
module IHaskell.Eval.Completion
complete :: String -> Int -> Interpreter (String, [String])

-- | Get the word under a given cursor location.
completionTarget :: String -> Int -> [String]

-- | Get which type of completion this is from the surrounding context.
completionType :: String -> Int -> [String] -> CompletionType
data CompletionType
Empty :: CompletionType
Identifier :: String -> CompletionType
DynFlag :: String -> CompletionType
Qualified :: String -> String -> CompletionType
ModuleName :: String -> String -> CompletionType
HsFilePath :: String -> String -> CompletionType
FilePath :: String -> String -> CompletionType
KernelOption :: String -> CompletionType
Extension :: String -> CompletionType
instance GHC.Classes.Eq IHaskell.Eval.Completion.CompletionType
instance GHC.Show.Show IHaskell.Eval.Completion.CompletionType
