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


-- | GUI framework that uses the web browser as a display.
--   
--   Threepenny-GUI is a GUI framework that uses the web browser as a
--   display.
--   
--   It's very easy to install because everyone has a web browser
--   installed.
--   
--   A program written with Threepenny is essentially a small web server
--   that displays the user interface as a web page to any browser that
--   connects to it. You can freely manipulate the HTML DOM and handle
--   JavaScript events from your Haskell code.
--   
--   Stability forecast: This is an experimental release! Send me your
--   feedback! Significant API changes are likely in future versions.
--   
--   NOTE: This library contains examples, but they are not built by
--   default. To build and install the example, use the
--   <tt>buildExamples</tt> flag like this
--   
--   <pre>
--   cabal install threepenny-gui -fbuildExamples
--   </pre>
@package threepenny-gui
@version 0.9.4.1

module Foreign.RemotePtr

-- | A <a>RemotePtr</a> is a pointer to a foreign object.
--   
--   Like a <tt>ForeignPtr</tt>, it refers to an object managed by an
--   environment external to the Haskell runtime. Likewise, you can assign
--   finalizers to a <a>RemotePtr</a>. The finalizers will be run when the
--   Haskell runtime garbage collects this value. They can perform some
--   cleanup operations, like freeing memory.
--   
--   Unlike a <tt>ForeignPtr</tt>, the object referenced by a
--   <a>RemotePtr</a> is not necessarily a block of RAM. Instead, it can
--   refer to things like an object managed by a remote program.
type RemotePtr a = IORef (RemoteData a)

-- | Access the data of the <a>RemotePtr</a>.
--   
--   While the action is being performed, it is ensured that the
--   <a>RemotePtr</a> will not be garbage collected and its <a>Coupon</a>
--   can be successfully redeemed at the <a>Vendor</a>.
withRemotePtr :: RemotePtr a -> (Coupon -> a -> IO b) -> IO b

-- | Add a finalizer that is run when the <a>RemotePtr</a> is garbage
--   collected.
--   
--   The associated coupon cannot be redeemed anymore while the finalizer
--   runs.
addFinalizer :: RemotePtr a -> IO () -> IO ()

-- | FIXME: Is this finalizer really run when <a>destroy</a> is called?
--   
--   Destroy a <a>RemotePtr</a> and run all finalizers for it.
--   <a>Coupon</a>s for this pointer can no longer be redeemed.
destroy :: RemotePtr a -> IO ()

-- | When dealing with several foreign objects, it is useful to model
--   dependencies between them.
--   
--   After this operation, the second <a>RemotePtr</a> will be reachable
--   whenever the first one is reachable. For instance, you should call
--   this function when the second foreign object is actually a subobject
--   of the first one.
--   
--   Note: It is possible to model dependencies in the <tt>parent</tt>
--   data, but the <a>addReachable</a> method is preferrable, as it allows
--   all child object to be garbage collected at once.
addReachable :: RemotePtr a -> RemotePtr b -> IO ()

-- | Clear all dependencies.
--   
--   Reachability of this <a>RemotePtr</a> no longer implies reachability
--   of other items, as formerly implied by calls to <a>addReachable</a>.
clearReachable :: RemotePtr a -> IO ()

-- | Unprotected access the <a>Coupon</a> of a <a>RemotePtr</a>.
--   
--   Note: There is no guarantee that the <a>RemotePtr</a> is alive after
--   this operation and that the <a>Coupon</a> can be redeemed at a
--   <a>Vendor</a>. Most of the time, you should use <a>withRemotePtr</a>
--   instead.
--   
--   Note: In particular, if you use this with <tt>unsafePerformIO</tt>,
--   the risk is high that you only refer to the <a>RemotePtr</a> argument
--   via the result just obtained, and the pointer will be garbage
--   collected.
unprotectedGetCoupon :: RemotePtr a -> IO Coupon

-- | A <a>Coupon</a> is a unique identifier.
--   
--   It is a string of alphanumeric ASCII characters and it is intended to
--   be sent to or received from a remote program.
--   
--   The data structure <a>Vendor</a> associates <a>Coupon</a>s to
--   <tt>RemotPtr</tt> objects.
type Coupon = Text

-- | Create a new <a>Coupon</a>.
--   
--   WARNING: This coupon is only unique relative to this <a>Vendor</a>.
--   There is no guarantee that this <a>Coupon</a> is globally unique,
--   certainly not on a remote machine.
newCoupon :: Vendor a -> IO Coupon

-- | A <a>Vendor</a> is a bijective mapping from <a>Coupon</a> to
--   <a>RemotePtr</a>.
--   
--   Every <a>Coupon</a> has at most one <a>RemotePtr</a> associated to it.
--   A single <a>RemotePtr</a> will always be associated with the same
--   <a>Coupon</a>.
data Vendor a

-- | Create a new <a>Vendor</a> for trading <a>Coupon</a>s and
--   <a>RemotePtr</a>s.
newVendor :: IO (Vendor a)

-- | Take a <a>Coupon</a> to a <a>Vendor</a> and maybe you'll get a
--   <a>RemotePtr</a> for it.
lookup :: Coupon -> Vendor a -> IO (Maybe (RemotePtr a))

-- | Create a new <a>RemotePtr</a> from a <a>Coupon</a> and register it
--   with a <a>Vendor</a>.
newRemotePtr :: Coupon -> a -> Vendor a -> IO (RemotePtr a)

module Foreign.JavaScript

-- | Run a <a>Foreign.JavaScript</a> server.
serve :: Config -> (Window -> IO ()) -> IO ()

-- | Default configuration.
--   
--   Port from environment variable or <tt>8023</tt>, listening on
--   <tt>localhost</tt>, no custom HTML, no static directory, logging to
--   stderr, do reload on disconnect, <b>buffer FFI calls</b>.
defaultConfig :: Config

-- | Static configuration for a <a>Foreign.JavaScript</a> server.
--   
--   This is a record type which has the following fields:
--   
--   <ul>
--   <li><pre>jsPort :: Maybe Int</pre>Port number. <tt>Nothing</tt> means
--   that the port number is read from the environment variable
--   <tt>PORT</tt>. Alternatively, port <tt>8023</tt> is used if this
--   variable is not set.</li>
--   <li><pre>jsAddr :: Maybe ByteString</pre>Bind address.
--   <tt>Nothing</tt> means that the bind address is read from the
--   environment variable <tt>ADDR</tt>. Alternatively, address
--   <tt>127.0.0.1</tt> is used if this variable is not set.</li>
--   <li><pre>jsCustomHTML :: Maybe FilePath</pre>Custom HTML file to
--   replace the default one.</li>
--   <li><pre>jsStatic :: Maybe FilePath</pre>Directory that is served
--   under <tt>/static</tt>.</li>
--   <li><pre>jsLog :: ByteString -&gt; IO ()</pre>Function to print a
--   single log message.</li>
--   <li><pre>jsWindowReloadOnDisconnect :: Bool</pre>Reload the browser
--   window if the connection to the server was dropped accidentally, for
--   instance because the computer was put to sleep and awoken again.</li>
--   <li><pre>jsCallBufferMode :: CallBufferMode</pre>The initial
--   <a>CallBufferMode</a> to use for <tt>runFunction</tt>. It can be
--   changed at any time with <tt>setCallBufferMode</tt>.</li>
--   <li><pre>jsUseSSLBind :: Maybe ConfigSSL</pre>Whether to serve on a
--   HTTPS connection instead of HTTP for improved
--   security.<ul><li><a>Just</a> with a <a>ConfigSSL</a> to serve on
--   HTTPS. Note that this will fail silently unless the
--   <tt>snap-server</tt> package has been compiled with the
--   <tt>openssl</tt> flag enabled.</li><li><a>Nothing</a> to serve on
--   HTTP.</li></ul></li>
--   </ul>
--   
--   (For reasons of forward compatibility, the constructor is not
--   exported.)
data Config

-- | Static configuration for the SSL version of the
--   <a>Foreign.JavaScript</a> server.
--   
--   This is a record type which has the following fields:
--   
--   <ul>
--   <li><pre>jsSSLBind :: ByteString</pre>Bind address.</li>
--   <li><pre>jsSSLCert :: FilePath</pre>Path to SSL certificate file.
--   Example: <tt>cert.pem</tt>.</li>
--   <li><pre>jsSSLChainCert :: Bool</pre>If it is SSL chain certificate
--   file.</li>
--   <li><pre>jsSSLKey :: FilePath</pre>Path to SSL key file. Example:
--   <tt>key.pem</tt>.</li>
--   <li><pre>jsSSLPort :: ByteString</pre>Port number. Example: 443.</li>
--   </ul>
data ConfigSSL
ConfigSSL :: ByteString -> FilePath -> Bool -> FilePath -> Int -> ConfigSSL
[jsSSLBind] :: ConfigSSL -> ByteString
[jsSSLCert] :: ConfigSSL -> FilePath
[jsSSLChainCert] :: ConfigSSL -> Bool
[jsSSLKey] :: ConfigSSL -> FilePath
[jsSSLPort] :: ConfigSSL -> Int

-- | Representation of a <a>Foreign.JavaScript</a> server.
--   
--   Can be used for dynamic configuration, e.g. serving additional files.
data Server

-- | MIME type.
type MimeType = String

-- | URI type.
--   
--   FIXME: Use the correct type from <a>Network.URI</a>
type URI = String

-- | Begin to serve a local file with a given <a>MimeType</a> under a URI.
loadFile :: Server -> MimeType -> FilePath -> IO String

-- | Begin to serve a local directory under a URI.
loadDirectory :: Server -> FilePath -> IO String

-- | Representation of a browser window.
data Window

-- | Server that the browser window communicates with.
getServer :: Window -> Server

-- | Cookies that the browser window has sent to the server when
--   connecting.
getCookies :: Window -> [Cookie]

-- | For the purpose of controlling garbage collection, every <a>Window</a>
--   as an associated <a>RemotePtr</a> that is alive as long as the
--   external JavaScript connection is alive.
root :: Window -> RemotePtr ()

-- | Helper class for rendering Haskell values as JavaScript expressions.
class ToJS a
render :: ToJS a => a -> IO JSCode
renderList :: ToJS a => [a] -> IO JSCode

-- | Helper class for converting JavaScript values to Haskell values.
class FromJS a

-- | A JavaScript function with a given output type <tt>a</tt>.
data JSFunction a

-- | A mutable JavaScript object.
type JSObject = RemotePtr JSPtr
data JavaScriptException

-- | Helper class for making <a>ffi</a> a variable argument function.
class FFI a

-- | Simple JavaScript FFI with string substitution.
--   
--   Inspired by the Fay language.
--   <a>https://github.com/faylang/fay/wiki</a>
--   
--   <pre>
--   example :: String -&gt; Int -&gt; JSFunction String
--   example = ffi "$(%1).prop('checked',%2)"
--   </pre>
--   
--   The <a>ffi</a> function takes a string argument representing the
--   JavaScript code to be executed on the client. Occurrences of the
--   substrings <tt>%1</tt> to <tt>%9</tt> will be replaced by subequent
--   arguments. The substring <tt>%%</tt> in the original will be replaced
--   by <tt>%</tt> (character escape).
--   
--   Note: Always specify a type signature! The types automate how values
--   are marshalled between Haskell and JavaScript. The class instances for
--   the <a>FFI</a> class show which conversions are supported.
ffi :: FFI a => String -> a

-- | Run a JavaScript function, but do not wait for a result.
--   
--   NOTE: The JavaScript function need not be executed immediately, it can
--   be buffered and sent to the browser window at a later time. See
--   <a>setCallBufferMode</a> and <a>flushCallBuffer</a> for more.
runFunction :: Window -> JSFunction () -> IO ()

-- | Call a JavaScript function and wait for the result.
callFunction :: Window -> JSFunction a -> IO a

-- | A mutable JavaScript object that has just been created. This a dummy
--   type used for additional type safety.
data NewJSObject

-- | Run a JavaScript function that creates a new object. Return a
--   corresponding <a>JSObject</a> without waiting for the browser to send
--   a result.
--   
--   WARNING: This function assumes that the supplied JavaScript code does,
--   in fact, create an object that is new.
unsafeCreateJSObject :: Window -> JSFunction NewJSObject -> IO JSObject

-- | Specification of how JavaScript functions should be called.
data CallBufferMode

-- | When <tt>runFunction</tt> is used to call a JavaScript function,
--   immediately send a message to the browser window to execute said
--   function.
NoBuffering :: CallBufferMode

-- | When <tt>runFunction</tt> is used to call a JavaScript function, hold
--   back any message to the server. All JavaScript functions that are held
--   back in this way are combined into a single message, which is finally
--   sent whenever <tt>callFunction</tt> or <tt>flushCallBuffer</tt> are
--   used, or an exported Haskell function is called.
BufferRun :: CallBufferMode

-- | The same as <a>BufferRun</a>, but this mode indicates client libraries
--   and programs are encouraged to flush the buffer more often to simplify
--   usage. Users may choose <a>BufferRun</a> instead if they want more
--   control over flushing the buffer.
FlushOften :: CallBufferMode

-- | The same as <a>BufferRun</a>, except that the buffer will also be
--   flushed every 300ms.
FlushPeriodically :: CallBufferMode

-- | Set the call buffering mode for the given browser window.
setCallBufferMode :: Window -> CallBufferMode -> IO ()

-- | Get the call buffering mode for the given browser window.
getCallBufferMode :: Window -> IO CallBufferMode

-- | Flush the call buffer, i.e. send all outstanding JavaScript to the
--   client in one single message.
flushCallBuffer :: Window -> IO ()

-- | Helper class for exporting Haskell functions to JavaScript as event
--   handlers.
class IsHandler a

-- | Export a Haskell function as an event handler.
--   
--   The result is a JavaScript <tt>Function</tt> object that can be called
--   from JavaScript like a regular function. However, the corresponding
--   Haskell function will <i>not</i> be run immediately, rather it will be
--   added to the event queue and processed like an event. In other words,
--   this the Haskell code is only called asynchronously.
--   
--   WARNING: The event handler will be garbage collected unless you keep a
--   reference to it <i>on the Haskell side</i>! Registering it with a
--   JavaScript function will generally <i>not</i> keep it alive.
exportHandler :: IsHandler a => Window -> a -> IO JSObject

-- | Register an action to be performed when the client disconnects.
onDisconnect :: Window -> IO () -> IO ()

-- | Send a debug message to the JavaScript console.
debug :: Window -> String -> IO ()

-- | Print a timestamp and the time difference to the previous one in the
--   JavaScript console.
timestamp :: Window -> IO ()

module Reactive.Threepenny

-- | <tt>Event a</tt> represents a stream of events as they occur in time.
--   Semantically, you can think of <tt>Event a</tt> as an infinite list of
--   values that are tagged with their corresponding time of occurence,
--   
--   <pre>
--   type Event a = [(Time,a)]
--   </pre>
data Event a

-- | <tt>Behavior a</tt> represents a value that varies in time. Think of
--   it as
--   
--   <pre>
--   type Behavior a = Time -&gt; a
--   </pre>
data Behavior a

-- | An <i>event handler</i> is a function that takes an <i>event value</i>
--   and performs some computation.
type Handler a = a -> IO ()

-- | Create a new event. Also returns a function that triggers an event
--   occurrence.
newEvent :: IO (Event a, Handler a)

-- | Register an event <a>Handler</a> for an <a>Event</a>. All registered
--   handlers will be called whenever the event occurs.
--   
--   When registering an event handler, you will also be given an action
--   that unregisters this handler again.
--   
--   <pre>
--   do unregisterMyHandler &lt;- register event myHandler
--   </pre>
--   
--   FIXME: Unregistering event handlers does not work yet.
register :: Event a -> Handler a -> IO (IO ())

-- | Read the current value of a <a>Behavior</a>.
currentValue :: MonadIO m => Behavior a -> m a

-- | Event that never occurs. Think of it as <tt>never = []</tt>.
never :: Event a

-- | Return all event occurrences that are <a>Just</a> values, discard the
--   rest. Think of it as
--   
--   <pre>
--   filterJust es = [(time,a) | (time,Just a) &lt;- es]
--   </pre>
filterJust :: Event (Maybe a) -> Event a

-- | Merge two event streams of the same type. In case of simultaneous
--   occurrences, the event values are combined with the binary function.
--   Think of it as
--   
--   <pre>
--   unionWith f ((timex,x):xs) ((timey,y):ys)
--      | timex == timey = (timex,f x y) : unionWith f xs ys
--      | timex &lt;  timey = (timex,x)     : unionWith f xs ((timey,y):ys)
--      | timex &gt;  timey = (timey,y)     : unionWith f ((timex,x):xs) ys
--   </pre>
unionWith :: (a -> a -> a) -> Event a -> Event a -> Event a

-- | The <a>accumE</a> function accumulates a stream of events. Example:
--   
--   <pre>
--   accumE "x" [(time1,(++"y")),(time2,(++"z"))]
--      = return [(time1,"xy"),(time2,"xyz")]
--   </pre>
--   
--   Note that the output events are simultaneous with the input events,
--   there is no "delay" like in the case of <a>accumB</a>.
accumE :: MonadIO m => a -> Event (a -> a) -> m (Event a)

-- | Apply a time-varying function to a stream of events. Think of it as
--   
--   <pre>
--   apply bf ex = [(time, bf time x) | (time, x) &lt;- ex]
--   </pre>
apply :: Behavior (a -> b) -> Event a -> Event b

-- | Construct a time-varying function from an initial value and a stream
--   of new values. Think of it as
--   
--   <pre>
--   stepper x0 ex = return $ \time -&gt;
--       last (x0 : [x | (timex,x) &lt;- ex, timex &lt; time])
--   </pre>
--   
--   Note that the smaller-than-sign in the comparison <tt>timex &lt;
--   time</tt> means that the value of the behavior changes "slightly
--   after" the event occurrences. This allows for recursive definitions.
stepper :: MonadIO m => a -> Event a -> m (Behavior a)

-- | Infix synonym for <a>apply</a>, similar to <a>&lt;*&gt;</a>.
(<@>) :: Behavior (a -> b) -> Event a -> Event b
infixl 4 <@>

-- | Variant of <a>apply</a> similar to <a>&lt;*</a>
(<@) :: Behavior a -> Event b -> Event a
infixl 4 <@

-- | Return all event occurrences that fulfill the predicate, discard the
--   rest.
filterE :: (a -> Bool) -> Event a -> Event a

-- | Return all event occurrences that fulfill the time-varying predicate,
--   discard the rest. Generalization of <a>filterE</a>.
filterApply :: Behavior (a -> Bool) -> Event a -> Event a

-- | Return event occurrences only when the behavior is <a>True</a>.
--   Variant of <a>filterApply</a>.
whenE :: Behavior Bool -> Event a -> Event a

-- | Split event occurrences according to a tag. The <a>Left</a> values go
--   into the left component while the <a>Right</a> values go into the
--   right component of the result.
split :: Event (Either a b) -> (Event a, Event b)

-- | Collect simultaneous event occurrences in a list.
unions :: [Event a] -> Event [a]

-- | Apply a list of functions in succession. Useful in conjunction with
--   <a>unions</a>.
--   
--   <pre>
--   concatenate [f,g,h] = f . g . h
--   </pre>
concatenate :: [a -> a] -> a -> a

-- | The <a>accumB</a> function is similar to a <i>strict</i> left fold,
--   <tt>foldl'</tt>. It starts with an initial value and combines it with
--   incoming events. For example, think
--   
--   <pre>
--   accumB "x" [(time1,(++"y")),(time2,(++"z"))]
--      = stepper "x" [(time1,"xy"),(time2,"xyz")]
--   </pre>
--   
--   Note that the value of the behavior changes "slightly after" the
--   events occur. This allows for recursive definitions.
accumB :: MonadIO m => a -> Event (a -> a) -> m (Behavior a)

-- | Efficient combination of <a>accumE</a> and <a>accumB</a>.
mapAccum :: MonadIO m => acc -> Event (acc -> (x, acc)) -> m (Event x, Behavior acc)

-- | Data type representing a behavior (<a>facts</a>) and suggestions to
--   change it (<a>rumors</a>).
data Tidings a

-- | Smart constructor. Combine facts and rumors into <a>Tidings</a>.
tidings :: Behavior a -> Event a -> Tidings a
facts :: Tidings a -> Behavior a
rumors :: Tidings a -> Event a

-- | Register an event <a>Handler</a> for a <a>Behavior</a>. All registered
--   handlers will be called whenever the behavior changes.
--   
--   However, note that this is only an approximation, as behaviors may
--   change continuously. Consequently, handlers should be idempotent.
onChange :: Behavior a -> Handler a -> IO ()
unsafeMapIO :: (a -> IO b) -> Event a -> Event b

-- | Create a series of events with delayed initialization.
--   
--   For each name, the initialization handler will be called exactly once
--   when the event is first "brought to life", e.g. when an event handler
--   is registered to it.
newEventsNamed :: Ord name => Handler (name, Event a, Handler a) -> IO (name -> Event a)
test :: IO (Int -> IO ())
test_recursion1 :: IO (IO ())
instance GHC.Base.Functor Reactive.Threepenny.Tidings
instance GHC.Base.Applicative Reactive.Threepenny.Tidings
instance GHC.Base.Functor Reactive.Threepenny.Behavior
instance GHC.Base.Applicative Reactive.Threepenny.Behavior
instance GHC.Base.Functor Reactive.Threepenny.Event

module Graphics.UI.Threepenny.Core

-- | Static configuration for a <a>Foreign.JavaScript</a> server.
--   
--   This is a record type which has the following fields:
--   
--   <ul>
--   <li><pre>jsPort :: Maybe Int</pre>Port number. <tt>Nothing</tt> means
--   that the port number is read from the environment variable
--   <tt>PORT</tt>. Alternatively, port <tt>8023</tt> is used if this
--   variable is not set.</li>
--   <li><pre>jsAddr :: Maybe ByteString</pre>Bind address.
--   <tt>Nothing</tt> means that the bind address is read from the
--   environment variable <tt>ADDR</tt>. Alternatively, address
--   <tt>127.0.0.1</tt> is used if this variable is not set.</li>
--   <li><pre>jsCustomHTML :: Maybe FilePath</pre>Custom HTML file to
--   replace the default one.</li>
--   <li><pre>jsStatic :: Maybe FilePath</pre>Directory that is served
--   under <tt>/static</tt>.</li>
--   <li><pre>jsLog :: ByteString -&gt; IO ()</pre>Function to print a
--   single log message.</li>
--   <li><pre>jsWindowReloadOnDisconnect :: Bool</pre>Reload the browser
--   window if the connection to the server was dropped accidentally, for
--   instance because the computer was put to sleep and awoken again.</li>
--   <li><pre>jsCallBufferMode :: CallBufferMode</pre>The initial
--   <a>CallBufferMode</a> to use for <tt>runFunction</tt>. It can be
--   changed at any time with <tt>setCallBufferMode</tt>.</li>
--   <li><pre>jsUseSSLBind :: Maybe ConfigSSL</pre>Whether to serve on a
--   HTTPS connection instead of HTTP for improved
--   security.<ul><li><a>Just</a> with a <a>ConfigSSL</a> to serve on
--   HTTPS. Note that this will fail silently unless the
--   <tt>snap-server</tt> package has been compiled with the
--   <tt>openssl</tt> flag enabled.</li><li><a>Nothing</a> to serve on
--   HTTP.</li></ul></li>
--   </ul>
--   
--   (For reasons of forward compatibility, the constructor is not
--   exported.)
data Config

-- | Static configuration for the SSL version of the
--   <a>Foreign.JavaScript</a> server.
--   
--   This is a record type which has the following fields:
--   
--   <ul>
--   <li><pre>jsSSLBind :: ByteString</pre>Bind address.</li>
--   <li><pre>jsSSLCert :: FilePath</pre>Path to SSL certificate file.
--   Example: <tt>cert.pem</tt>.</li>
--   <li><pre>jsSSLChainCert :: Bool</pre>If it is SSL chain certificate
--   file.</li>
--   <li><pre>jsSSLKey :: FilePath</pre>Path to SSL key file. Example:
--   <tt>key.pem</tt>.</li>
--   <li><pre>jsSSLPort :: ByteString</pre>Port number. Example: 443.</li>
--   </ul>
data ConfigSSL
ConfigSSL :: ByteString -> FilePath -> Bool -> FilePath -> Int -> ConfigSSL
[jsSSLBind] :: ConfigSSL -> ByteString
[jsSSLCert] :: ConfigSSL -> FilePath
[jsSSLChainCert] :: ConfigSSL -> Bool
[jsSSLKey] :: ConfigSSL -> FilePath
[jsSSLPort] :: ConfigSSL -> Int

-- | Default configuration.
--   
--   Port from environment variable or <tt>8023</tt>, listening on
--   <tt>localhost</tt>, no custom HTML, no static directory, logging to
--   stderr, do reload on disconnect, <b>buffer FFI calls</b>.
defaultConfig :: Config

-- | Start server for GUI sessions.
startGUI :: Config -> (Window -> UI ()) -> IO ()

-- | Begin to serve a local file with a given <a>MimeType</a> under a
--   relative URI.
loadFile :: String -> FilePath -> UI String

-- | Make a local directory available under a relative URI.
loadDirectory :: FilePath -> UI String

-- | User interface elements are created and manipulated in the <a>UI</a>
--   monad.
--   
--   This monad is essentially just a thin wrapper around the familiar
--   <a>IO</a> monad. Use the <a>liftIO</a> function to access <a>IO</a>
--   operations like reading and writing from files.
--   
--   There are several subtle reasons why Threepenny uses a custom
--   <a>UI</a> monad instead of the standard <a>IO</a> monad:
--   
--   <ul>
--   <li>More convenience when calling JavaScript. The monad keeps track of
--   a browser <a>Window</a> context in which JavaScript function calls are
--   executed.</li>
--   <li>Recursion for functional reactive programming.</li>
--   </ul>
data UI a

-- | Execute an <a>UI</a> action in a particular browser window. Also runs
--   all scheduled <a>IO</a> actions.
runUI :: Window -> UI a -> IO a
class (Monad m) => MonadUI m

-- | Lift a computation from the <a>UI</a> monad.
liftUI :: MonadUI m => UI a -> m a

-- | Retrieve current <a>Window</a> context in the <a>UI</a> monad.
askWindow :: UI Window

-- | Schedule an <a>IO</a> action to be run later.
liftIOLater :: IO () -> UI ()

-- | The type <a>Window</a> represents a browser window.
data Window

-- | Title of the client window.
title :: WriteAttr Window String
data Element
getWindow :: Element -> IO Window

-- | Make a new DOM element with a given tag name.
mkElement :: String -> UI Element

-- | Make a new DOM element with a namespace and a given tag name.
--   
--   A namespace <a>Nothing</a> corresponds to the default HTML namespace.
mkElementNamespace :: Maybe String -> String -> UI Element

-- | Delete the given element.
--   
--   This operation removes the element from the browser window DOM and
--   marks it for garbage collection on the Haskell side. The element is
--   unusable afterwards.
--   
--   NOTE: If you wish to temporarily remove an element from the DOM tree,
--   change the <tt>children</tt> property of its parent element instead.
delete :: Element -> UI ()

-- | Make a <tt>span</tt> element with a given text content.
string :: String -> UI Element

-- | Get the head of the page.
getHead :: Window -> UI Element

-- | Get the body of the page.
getBody :: Window -> UI Element

-- | Append DOM elements as children to a given element.
(#+) :: UI Element -> [UI Element] -> UI Element
infixl 8 #+

-- | Child elements of a given element.
children :: WriteAttr Element [Element]

-- | Text content of an element.
text :: WriteAttr Element String

-- | Child elements of a given element as a HTML string.
html :: WriteAttr Element String

-- | HTML attributes of an element.
attr :: String -> WriteAttr Element String

-- | Set CSS style of an Element
style :: WriteAttr Element [(String, String)]

-- | Value attribute of an element. Particularly relevant for control
--   widgets like <tt>input</tt>.
value :: Attr Element String

-- | Get all elements of the given tag name.
getElementsByTagName :: Window -> String -> UI [Element]

-- | Get an element by a particular ID.
getElementById :: Window -> String -> UI (Maybe Element)

-- | Get a list of elements by particular class.
getElementsByClassName :: Window -> String -> UI [Element]

-- | Align given elements in a rectangular grid.
--   
--   Layout is achieved by using the CSS <tt>display:table</tt> property.
--   The following element tree will be generated
--   
--   <pre>
--   &lt;div class="table"&gt;
--     &lt;div class="table-row"&gt;
--       &lt;div class="table-cell"&gt; ... &lt;/div&gt;
--       &lt;div class="table-cell"&gt; ... &lt;/div&gt;
--     &lt;/div&gt;
--     &lt;div class="table-row"&gt;
--       ...
--     &lt;/div&gt;
--    ...
--    &lt;/div&gt;
--   </pre>
--   
--   You can customatize the actual layout by assigning an <tt>id</tt> to
--   the element and changing the <tt>.table</tt>, <tt>.table-row</tt> and
--   <tt>table-column</tt> classes in a custom CSS file.
grid :: [[UI Element]] -> UI Element

-- | Align given elements in a row. Special case of <a>grid</a>.
row :: [UI Element] -> UI Element

-- | Align given elements in a column. Special case of <a>grid</a>.
column :: [UI Element] -> UI Element

-- | Events may carry data. At the moment, they may return a single JSON
--   value, as defined in the <a>Data.Aeson</a> module.
type EventData = Value

-- | Obtain DOM event for a given element.
domEvent :: String -> Element -> Event EventData

-- | Convert event data to a Haskell value. Throws an exception when the
--   data cannot be converted.
unsafeFromJSON :: FromJSON a => EventData -> a

-- | Event that occurs whenever the client has disconnected, be it by
--   closing the browser window or by exception.
--   
--   Note: DOM Elements in a browser window that has been closed can no
--   longer be manipulated.
disconnect :: Window -> Event ()

-- | Convenience function to register <a>Event</a>s for <a>Element</a>s.
--   
--   Example usage.
--   
--   <pre>
--   on click element $ \_ -&gt; ...
--   </pre>
on :: (element -> Event a) -> element -> (a -> UI void) -> UI ()

-- | Register an <a>UI</a> action to be executed whenever the <a>Event</a>
--   happens.
--   
--   FIXME: Should be unified with <a>on</a>?
onEvent :: Event a -> (a -> UI void) -> UI (UI ())

-- | Execute a <a>UI</a> action whenever a <a>Behavior</a> changes. Use
--   sparingly, it is recommended that you use <a>sink</a> instead.
onChanges :: Behavior a -> (a -> UI void) -> UI ()

-- | Replace all locations in the input with the same value. The default
--   definition is <tt><a>fmap</a> . <a>const</a></tt>, but this may be
--   overridden with a more efficient version.
--   
--   Using <tt>ApplicativeDo</tt>: '<tt>a <a>&lt;$</a> bs</tt>' can be
--   understood as the <tt>do</tt> expression
--   
--   <pre>
--   do bs
--      pure a
--   </pre>
--   
--   with an inferred <tt>Functor</tt> constraint.
(<$) :: Functor f => a -> f b -> f a
infixl 4 <$

-- | A functor with application, providing operations to
--   
--   <ul>
--   <li>embed pure expressions (<a>pure</a>), and</li>
--   <li>sequence computations and combine their results (<a>&lt;*&gt;</a>
--   and <a>liftA2</a>).</li>
--   </ul>
--   
--   A minimal complete definition must include implementations of
--   <a>pure</a> and of either <a>&lt;*&gt;</a> or <a>liftA2</a>. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   <pre>
--   (<a>&lt;*&gt;</a>) = <a>liftA2</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>liftA2</a> f x y = f <a>&lt;$&gt;</a> x <a>&lt;*&gt;</a> y
--   </pre>
--   
--   Further, any definition must satisfy the following:
--   
--   <ul>
--   <li><i>Identity</i> <pre><a>pure</a> <a>id</a> <a>&lt;*&gt;</a> v =
--   v</pre></li>
--   <li><i>Composition</i> <pre><a>pure</a> (.) <a>&lt;*&gt;</a> u
--   <a>&lt;*&gt;</a> v <a>&lt;*&gt;</a> w = u <a>&lt;*&gt;</a> (v
--   <a>&lt;*&gt;</a> w)</pre></li>
--   <li><i>Homomorphism</i> <pre><a>pure</a> f <a>&lt;*&gt;</a>
--   <a>pure</a> x = <a>pure</a> (f x)</pre></li>
--   <li><i>Interchange</i> <pre>u <a>&lt;*&gt;</a> <a>pure</a> y =
--   <a>pure</a> (<a>$</a> y) <a>&lt;*&gt;</a> u</pre></li>
--   </ul>
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   <ul>
--   <li><pre>u <a>*&gt;</a> v = (<a>id</a> <a>&lt;$</a> u)
--   <a>&lt;*&gt;</a> v</pre></li>
--   <li><pre>u <a>&lt;*</a> v = <a>liftA2</a> <a>const</a> u v</pre></li>
--   </ul>
--   
--   As a consequence of these laws, the <a>Functor</a> instance for
--   <tt>f</tt> will satisfy
--   
--   <ul>
--   <li><pre><a>fmap</a> f x = <a>pure</a> f <a>&lt;*&gt;</a> x</pre></li>
--   </ul>
--   
--   It may be useful to note that supposing
--   
--   <pre>
--   forall x y. p (q x y) = f x . g y
--   </pre>
--   
--   it follows from the above that
--   
--   <pre>
--   <a>liftA2</a> p (<a>liftA2</a> q u v) = <a>liftA2</a> f u . <a>liftA2</a> g v
--   </pre>
--   
--   If <tt>f</tt> is also a <a>Monad</a>, it should satisfy
--   
--   <ul>
--   <li><pre><a>pure</a> = <a>return</a></pre></li>
--   <li><pre>m1 <a>&lt;*&gt;</a> m2 = m1 <a>&gt;&gt;=</a> (x1 -&gt; m2
--   <a>&gt;&gt;=</a> (x2 -&gt; <a>return</a> (x1 x2)))</pre></li>
--   <li><pre>(<a>*&gt;</a>) = (<a>&gt;&gt;</a>)</pre></li>
--   </ul>
--   
--   (which implies that <a>pure</a> and <a>&lt;*&gt;</a> satisfy the
--   applicative functor laws).
class Functor f => Applicative (f :: Type -> Type)

-- | Lift a value.
pure :: Applicative f => a -> f a

-- | Sequential application.
--   
--   A few functors support an implementation of <a>&lt;*&gt;</a> that is
--   more efficient than the default one.
--   
--   Using <tt>ApplicativeDo</tt>: '<tt>fs <a>&lt;*&gt;</a> as</tt>' can be
--   understood as the <tt>do</tt> expression
--   
--   <pre>
--   do f &lt;- fs
--      a &lt;- as
--      pure (f a)
--   </pre>
(<*>) :: Applicative f => f (a -> b) -> f a -> f b

-- | Lift a binary function to actions.
--   
--   Some functors support an implementation of <a>liftA2</a> that is more
--   efficient than the default one. In particular, if <a>fmap</a> is an
--   expensive operation, it is likely better to use <a>liftA2</a> than to
--   <a>fmap</a> over the structure and then use <a>&lt;*&gt;</a>.
--   
--   This became a typeclass method in 4.10.0.0. Prior to that, it was a
--   function defined in terms of <a>&lt;*&gt;</a> and <a>fmap</a>.
--   
--   Using <tt>ApplicativeDo</tt>: '<tt><a>liftA2</a> f as bs</tt>' can be
--   understood as the <tt>do</tt> expression
--   
--   <pre>
--   do a &lt;- as
--      b &lt;- bs
--      pure (f a b)
--   </pre>
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c

-- | Sequence actions, discarding the value of the first argument.
--   
--   '<tt>as <a>*&gt;</a> bs</tt>' can be understood as the <tt>do</tt>
--   expression
--   
--   <pre>
--   do as
--      bs
--   </pre>
--   
--   This is a tad complicated for our <tt>ApplicativeDo</tt> extension
--   which will give it a <tt>Monad</tt> constraint. For an
--   <tt>Applicative</tt> constraint we write it of the form
--   
--   <pre>
--   do _ &lt;- as
--      b &lt;- bs
--      pure b
--   </pre>
(*>) :: Applicative f => f a -> f b -> f b

-- | Sequence actions, discarding the value of the second argument.
--   
--   Using <tt>ApplicativeDo</tt>: '<tt>as <a>&lt;*</a> bs</tt>' can be
--   understood as the <tt>do</tt> expression
--   
--   <pre>
--   do a &lt;- as
--      bs
--      pure a
--   </pre>
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*
infixl 4 *>
infixl 4 <*>

-- | An infix synonym for <a>fmap</a>.
--   
--   The name of this operator is an allusion to <a>$</a>. Note the
--   similarities between their types:
--   
--   <pre>
--    ($)  ::              (a -&gt; b) -&gt;   a -&gt;   b
--   (&lt;$&gt;) :: Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
--   </pre>
--   
--   Whereas <a>$</a> is function application, <a>&lt;$&gt;</a> is function
--   application lifted over a <a>Functor</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Convert from a <tt><a>Maybe</a> <a>Int</a></tt> to a <tt><a>Maybe</a>
--   <a>String</a></tt> using <a>show</a>:
--   
--   <pre>
--   &gt;&gt;&gt; show &lt;$&gt; Nothing
--   Nothing
--   
--   &gt;&gt;&gt; show &lt;$&gt; Just 3
--   Just "3"
--   </pre>
--   
--   Convert from an <tt><a>Either</a> <a>Int</a> <a>Int</a></tt> to an
--   <tt><a>Either</a> <a>Int</a></tt> <a>String</a> using <a>show</a>:
--   
--   <pre>
--   &gt;&gt;&gt; show &lt;$&gt; Left 17
--   Left 17
--   
--   &gt;&gt;&gt; show &lt;$&gt; Right 17
--   Right "17"
--   </pre>
--   
--   Double each element of a list:
--   
--   <pre>
--   &gt;&gt;&gt; (*2) &lt;$&gt; [1,2,3]
--   [2,4,6]
--   </pre>
--   
--   Apply <a>even</a> to the second element of a pair:
--   
--   <pre>
--   &gt;&gt;&gt; even &lt;$&gt; (2,2)
--   (2,True)
--   </pre>
(<$>) :: Functor f => (a -> b) -> f a -> f b
infixl 4 <$>

-- | One or none.
optional :: Alternative f => f a -> f (Maybe a)
newtype WrappedMonad (m :: Type -> Type) a
WrapMonad :: m a -> WrappedMonad (m :: Type -> Type) a
[unwrapMonad] :: WrappedMonad (m :: Type -> Type) a -> m a
newtype WrappedArrow (a :: Type -> Type -> Type) b c
WrapArrow :: a b c -> WrappedArrow (a :: Type -> Type -> Type) b c
[unwrapArrow] :: WrappedArrow (a :: Type -> Type -> Type) b c -> a b c

-- | Lists, but with an <a>Applicative</a> functor based on zipping.
newtype ZipList a
ZipList :: [a] -> ZipList a
[getZipList] :: ZipList a -> [a]

-- | The <a>Const</a> functor.
newtype Const a (b :: k)
Const :: a -> Const a (b :: k)
[getConst] :: Const a (b :: k) -> a

-- | Lift a ternary function to actions.
--   
--   Using <tt>ApplicativeDo</tt>: '<tt><a>liftA3</a> f as bs cs</tt>' can
--   be understood as the <tt>do</tt> expression
--   
--   <pre>
--   do a &lt;- as
--      b &lt;- bs
--      c &lt;- cs
--      pure (f a b c)
--   </pre>
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d

-- | Lift a function to actions. This function may be used as a value for
--   <a>fmap</a> in a <a>Functor</a> instance.
--   
--   | Using <tt>ApplicativeDo</tt>: '<tt><a>liftA</a> f as</tt>' can be
--   understood as the <tt>do</tt> expression
--   
--   <pre>
--   do a &lt;- as
--      pure (f a)
--   </pre>
--   
--   with an inferred <tt>Functor</tt> constraint, weaker than
--   <tt>Applicative</tt>.
liftA :: Applicative f => (a -> b) -> f a -> f b

-- | A variant of <a>&lt;*&gt;</a> with the arguments reversed.
--   
--   Using <tt>ApplicativeDo</tt>: '<tt>as <a>&lt;**&gt;</a> fs</tt>' can
--   be understood as the <tt>do</tt> expression
--   
--   <pre>
--   do a &lt;- as
--      f &lt;- fs
--      pure (f a)
--   </pre>
(<**>) :: Applicative f => f a -> f (a -> b) -> f b
infixl 4 <**>

-- | A monoid on applicative functors.
--   
--   If defined, <a>some</a> and <a>many</a> should be the least solutions
--   of the equations:
--   
--   <ul>
--   <li><pre><a>some</a> v = (:) <a>&lt;$&gt;</a> v <a>&lt;*&gt;</a>
--   <a>many</a> v</pre></li>
--   <li><pre><a>many</a> v = <a>some</a> v <a>&lt;|&gt;</a> <a>pure</a>
--   []</pre></li>
--   </ul>
class Applicative f => Alternative (f :: Type -> Type)

-- | The identity of <a>&lt;|&gt;</a>
empty :: Alternative f => f a

-- | An associative binary operation
(<|>) :: Alternative f => f a -> f a -> f a

-- | One or more.
some :: Alternative f => f a -> f [a]

-- | Zero or more.
many :: Alternative f => f a -> f [a]
infixl 3 <|>

-- | Data type representing a behavior (<a>facts</a>) and suggestions to
--   change it (<a>rumors</a>).
data Tidings a

-- | An <i>event handler</i> is a function that takes an <i>event value</i>
--   and performs some computation.
type Handler a = a -> IO ()

-- | <tt>Behavior a</tt> represents a value that varies in time. Think of
--   it as
--   
--   <pre>
--   type Behavior a = Time -&gt; a
--   </pre>
data Behavior a

-- | <tt>Event a</tt> represents a stream of events as they occur in time.
--   Semantically, you can think of <tt>Event a</tt> as an infinite list of
--   values that are tagged with their corresponding time of occurence,
--   
--   <pre>
--   type Event a = [(Time,a)]
--   </pre>
data Event a

-- | Create a new event. Also returns a function that triggers an event
--   occurrence.
newEvent :: IO (Event a, Handler a)

-- | Create a series of events with delayed initialization.
--   
--   For each name, the initialization handler will be called exactly once
--   when the event is first "brought to life", e.g. when an event handler
--   is registered to it.
newEventsNamed :: Ord name => Handler (name, Event a, Handler a) -> IO (name -> Event a)

-- | Register an event <a>Handler</a> for an <a>Event</a>. All registered
--   handlers will be called whenever the event occurs.
--   
--   When registering an event handler, you will also be given an action
--   that unregisters this handler again.
--   
--   <pre>
--   do unregisterMyHandler &lt;- register event myHandler
--   </pre>
--   
--   FIXME: Unregistering event handlers does not work yet.
register :: Event a -> Handler a -> IO (IO ())

-- | Read the current value of a <a>Behavior</a>.
currentValue :: MonadIO m => Behavior a -> m a
unsafeMapIO :: (a -> IO b) -> Event a -> Event b

-- | Event that never occurs. Think of it as <tt>never = []</tt>.
never :: Event a

-- | Return all event occurrences that are <a>Just</a> values, discard the
--   rest. Think of it as
--   
--   <pre>
--   filterJust es = [(time,a) | (time,Just a) &lt;- es]
--   </pre>
filterJust :: Event (Maybe a) -> Event a

-- | Merge two event streams of the same type. In case of simultaneous
--   occurrences, the event values are combined with the binary function.
--   Think of it as
--   
--   <pre>
--   unionWith f ((timex,x):xs) ((timey,y):ys)
--      | timex == timey = (timex,f x y) : unionWith f xs ys
--      | timex &lt;  timey = (timex,x)     : unionWith f xs ((timey,y):ys)
--      | timex &gt;  timey = (timey,y)     : unionWith f ((timex,x):xs) ys
--   </pre>
unionWith :: (a -> a -> a) -> Event a -> Event a -> Event a

-- | Apply a time-varying function to a stream of events. Think of it as
--   
--   <pre>
--   apply bf ex = [(time, bf time x) | (time, x) &lt;- ex]
--   </pre>
apply :: Behavior (a -> b) -> Event a -> Event b

-- | Infix synonym for <a>apply</a>, similar to <a>&lt;*&gt;</a>.
(<@>) :: Behavior (a -> b) -> Event a -> Event b
infixl 4 <@>

-- | Variant of <a>apply</a> similar to <a>&lt;*</a>
(<@) :: Behavior a -> Event b -> Event a
infixl 4 <@

-- | The <a>accumB</a> function is similar to a <i>strict</i> left fold,
--   <tt>foldl'</tt>. It starts with an initial value and combines it with
--   incoming events. For example, think
--   
--   <pre>
--   accumB "x" [(time1,(++"y")),(time2,(++"z"))]
--      = stepper "x" [(time1,"xy"),(time2,"xyz")]
--   </pre>
--   
--   Note that the value of the behavior changes "slightly after" the
--   events occur. This allows for recursive definitions.
accumB :: MonadIO m => a -> Event (a -> a) -> m (Behavior a)

-- | Construct a time-varying function from an initial value and a stream
--   of new values. Think of it as
--   
--   <pre>
--   stepper x0 ex = return $ \time -&gt;
--       last (x0 : [x | (timex,x) &lt;- ex, timex &lt; time])
--   </pre>
--   
--   Note that the smaller-than-sign in the comparison <tt>timex &lt;
--   time</tt> means that the value of the behavior changes "slightly
--   after" the event occurrences. This allows for recursive definitions.
stepper :: MonadIO m => a -> Event a -> m (Behavior a)

-- | The <a>accumE</a> function accumulates a stream of events. Example:
--   
--   <pre>
--   accumE "x" [(time1,(++"y")),(time2,(++"z"))]
--      = return [(time1,"xy"),(time2,"xyz")]
--   </pre>
--   
--   Note that the output events are simultaneous with the input events,
--   there is no "delay" like in the case of <a>accumB</a>.
accumE :: MonadIO m => a -> Event (a -> a) -> m (Event a)

-- | Return all event occurrences that fulfill the predicate, discard the
--   rest.
filterE :: (a -> Bool) -> Event a -> Event a

-- | Return all event occurrences that fulfill the time-varying predicate,
--   discard the rest. Generalization of <a>filterE</a>.
filterApply :: Behavior (a -> Bool) -> Event a -> Event a

-- | Return event occurrences only when the behavior is <a>True</a>.
--   Variant of <a>filterApply</a>.
whenE :: Behavior Bool -> Event a -> Event a

-- | Split event occurrences according to a tag. The <a>Left</a> values go
--   into the left component while the <a>Right</a> values go into the
--   right component of the result.
split :: Event (Either a b) -> (Event a, Event b)

-- | Collect simultaneous event occurrences in a list.
unions :: [Event a] -> Event [a]

-- | Apply a list of functions in succession. Useful in conjunction with
--   <a>unions</a>.
--   
--   <pre>
--   concatenate [f,g,h] = f . g . h
--   </pre>
concatenate :: [a -> a] -> a -> a

-- | Efficient combination of <a>accumE</a> and <a>accumB</a>.
mapAccum :: MonadIO m => acc -> Event (acc -> (x, acc)) -> m (Event x, Behavior acc)

-- | Smart constructor. Combine facts and rumors into <a>Tidings</a>.
tidings :: Behavior a -> Event a -> Tidings a
test :: IO (Int -> IO ())
test_recursion1 :: IO (IO ())

-- | Reverse function application. Allows convenient notation for setting
--   properties.
--   
--   Example usage.
--   
--   <pre>
--   mkElement "div"
--       # set style     [("color","#CCAABB")]
--       # set draggable True
--       # set children  otherElements
--   </pre>
(#) :: a -> (a -> b) -> b
infixl 8 #

-- | Convenient combinator for setting the CSS class on element creation.
(#.) :: UI Element -> String -> UI Element
infixl 8 #.

-- | Attributes can be <a>set</a> and <a>get</a>.
type Attr x a = ReadWriteAttr x a a

-- | Attribute that only supports the <a>set</a> operation.
type WriteAttr x i = ReadWriteAttr x i ()

-- | Attribute that only supports the <a>get</a> operation.
type ReadAttr x o = ReadWriteAttr x () o

-- | Generalized attribute with different types for getting and setting.
data ReadWriteAttr x i o
ReadWriteAttr :: (x -> UI o) -> (i -> x -> UI ()) -> ReadWriteAttr x i o
[get'] :: ReadWriteAttr x i o -> x -> UI o
[set'] :: ReadWriteAttr x i o -> i -> x -> UI ()

-- | Set value of an attribute in the <a>UI</a> monad. Best used in
--   conjunction with <a>#</a>.
set :: ReadWriteAttr x i o -> i -> UI x -> UI x

-- | Set the value of an attribute to a <a>Behavior</a>, that is a
--   time-varying value.
--   
--   Note: For reasons of efficiency, the attribute is only updated when
--   the value changes.
sink :: ReadWriteAttr x i o -> Behavior i -> UI x -> UI x

-- | Get attribute value.
get :: ReadWriteAttr x i o -> x -> UI o

-- | Build an attribute from a getter and a setter.
mkReadWriteAttr :: (x -> UI o) -> (i -> x -> UI ()) -> ReadWriteAttr x i o

-- | Build attribute from a setter.
mkWriteAttr :: (i -> x -> UI ()) -> WriteAttr x i

-- | Build attribute from a getter.
mkReadAttr :: (x -> UI o) -> ReadAttr x o

-- | Map input and output type of an attribute.
bimapAttr :: (i' -> i) -> (o -> o') -> ReadWriteAttr x i o -> ReadWriteAttr x i' o'

-- | Turn a JavaScript object property <tt>.prop = ...</tt> into an
--   attribute.
fromObjectProperty :: (FromJS a, ToJS a) => String -> Attr Element a

-- | Widgets are data types that have a visual representation.
class Widget w
getElement :: Widget w => w -> Element

-- | Convenience synonym for <a>return</a> to make elements work well with
--   <a>set</a>. Also works on <a>Widget</a>s.
--   
--   Example usage.
--   
--   <pre>
--   e &lt;- mkElement "button"
--   element e # set text "Ok"
--   </pre>
element :: MonadIO m => Widget w => w -> m Element

-- | Convenience synonym for <a>return</a> to make widgets work well with
--   <a>set</a>.
widget :: Widget w => w -> UI w

-- | Print a message on the client console if the client has debugging
--   enabled.
debug :: String -> UI ()

-- | Print a timestamp and the difference to the previous timestamp on the
--   client console if the client has debugging enabled.
timestamp :: UI ()

-- | Helper class for rendering Haskell values as JavaScript expressions.
class ToJS a

-- | Helper class for making <a>ffi</a> a variable argument function.
class FFI a

-- | A JavaScript function with a given output type <tt>a</tt>.
data JSFunction a

-- | Simple JavaScript FFI with string substitution.
--   
--   Inspired by the Fay language.
--   <a>https://github.com/faylang/fay/wiki</a>
--   
--   <pre>
--   example :: String -&gt; Int -&gt; JSFunction String
--   example = ffi "$(%1).prop('checked',%2)"
--   </pre>
--   
--   The <a>ffi</a> function takes a string argument representing the
--   JavaScript code to be executed on the client. Occurrences of the
--   substrings <tt>%1</tt> to <tt>%9</tt> will be replaced by subequent
--   arguments. The substring <tt>%%</tt> in the original will be replaced
--   by <tt>%</tt> (character escape).
--   
--   Note: Always specify a type signature! The types automate how values
--   are marshalled between Haskell and JavaScript. The class instances for
--   the <a>FFI</a> class show which conversions are supported.
ffi :: FFI a => String -> a

-- | Run a JavaScript function, but do not wait for a result.
--   
--   The client window uses JavaScript's <tt>eval()</tt> function to run
--   the code.
--   
--   NOTE: The JavaScript function need not be executed immediately, it can
--   be buffered and sent to the browser window at a later time. See
--   <a>setCallBufferMode</a> and <a>flushCallBuffer</a> for more.
runFunction :: JSFunction () -> UI ()

-- | Call a JavaScript function and wait for the result.
--   
--   The client window uses JavaScript's <tt>eval()</tt> function to run
--   the code.
callFunction :: JSFunction a -> UI a

-- | Specification of how JavaScript functions should be called.
data CallBufferMode

-- | When <tt>runFunction</tt> is used to call a JavaScript function,
--   immediately send a message to the browser window to execute said
--   function.
NoBuffering :: CallBufferMode

-- | When <tt>runFunction</tt> is used to call a JavaScript function, hold
--   back any message to the server. All JavaScript functions that are held
--   back in this way are combined into a single message, which is finally
--   sent whenever <tt>callFunction</tt> or <tt>flushCallBuffer</tt> are
--   used, or an exported Haskell function is called.
BufferRun :: CallBufferMode

-- | The same as <a>BufferRun</a>, but this mode indicates client libraries
--   and programs are encouraged to flush the buffer more often to simplify
--   usage. Users may choose <a>BufferRun</a> instead if they want more
--   control over flushing the buffer.
FlushOften :: CallBufferMode

-- | The same as <a>BufferRun</a>, except that the buffer will also be
--   flushed every 300ms.
FlushPeriodically :: CallBufferMode

-- | Set the call buffering mode for the browser window.
setCallBufferMode :: CallBufferMode -> UI ()

-- | Flush the call buffer, i.e. send all outstanding JavaScript to the
--   client in one single message.
flushCallBuffer :: UI ()

-- | Export the given Haskell function so that it can be called from
--   JavaScript code.
--   
--   NOTE: At the moment, the <a>JSObject</a> representing the exported
--   function will be referenced by the browser <a>Window</a> in which it
--   was created, preventing garbage collection until this browser
--   <a>Window</a> is disconnected.
--   
--   This makes it possible to use it as an event handler on the JavaScript
--   side, but it also means that the Haskell runtime has no way to detect
--   early when it is no longer needed.
--   
--   In contrast, if you use the function <a>domEvent</a> to register an
--   event handler to an <a>Element</a>, then the handler will be garbage
--   collected as soon as the associated <a>Element</a> is garbage
--   collected.
ffiExport :: IsHandler a => a -> UI JSObject

-- | Access to the primitive <a>JSObject</a> for roll-your-own foreign
--   calls.
toJSObject :: Element -> JSObject

-- | Access to the primitive <a>Window</a> object, for roll-your-own JS
--   foreign calls.
liftJSWindow :: (Window -> IO a) -> UI a

-- | Turn a jQuery property <tt>.prop()</tt> into an attribute.
fromJQueryProp :: String -> (Value -> a) -> (a -> Value) -> Attr Element a
instance Graphics.UI.Threepenny.Core.Widget Graphics.UI.Threepenny.Internal.Element
instance GHC.Base.Functor (Graphics.UI.Threepenny.Core.ReadWriteAttr x i)

module Graphics.UI.Threepenny.Timer
data Timer

-- | Create a new timer
timer :: UI Timer

-- | Timer interval in milliseconds.
interval :: Attr Timer Int

-- | Whether the timer is running or not.
running :: Attr Timer Bool

-- | Timer event.
tick :: Timer -> Event ()

-- | Start the timer.
start :: Timer -> UI ()

-- | Stop the timer.
stop :: Timer -> UI ()

module Graphics.UI.Threepenny.SVG.Elements
a :: UI Element
altGlyph :: UI Element
altGlyphDef :: UI Element
altGlyphItem :: UI Element
animate :: UI Element
animateColor :: UI Element
animateMotion :: UI Element
animateTransform :: UI Element
circle :: UI Element
clipPath :: UI Element
colorProfile :: UI Element
cursor :: UI Element
defs :: UI Element
desc :: UI Element
ellipse :: UI Element
feBlend :: UI Element
feColorMatrix :: UI Element
feComponentTransfer :: UI Element
feComposite :: UI Element
feConvolveMatrix :: UI Element
feDiffuseLighting :: UI Element
feDisplacementMap :: UI Element
feDistantLight :: UI Element
feFlood :: UI Element
feFuncA :: UI Element
feFuncB :: UI Element
feFuncG :: UI Element
feFuncR :: UI Element
feGaussianBlur :: UI Element
feImage :: UI Element
feMerge :: UI Element
feMergeNode :: UI Element
feMorphology :: UI Element
feOffset :: UI Element
fePointLight :: UI Element
feSpecularLighting :: UI Element
feSpotLight :: UI Element
feTile :: UI Element
feTurbulence :: UI Element
filter :: UI Element
font :: UI Element
font_face :: UI Element
font_face_format :: UI Element
font_face_name :: UI Element
font_face_srv :: UI Element
font_face_uri :: UI Element
foreignObject :: UI Element
g :: UI Element
glyph :: UI Element
glyphRef :: UI Element
hkern :: UI Element
image :: UI Element
line :: UI Element
linearGradient :: UI Element
marker :: UI Element
mask :: UI Element
metadata :: UI Element
missing_glyph :: UI Element
mpath :: UI Element
path :: UI Element
pattern :: UI Element
polygon :: UI Element
polyline :: UI Element
radialGradient :: UI Element
rect :: UI Element
script :: UI Element
set :: UI Element
stop :: UI Element
style :: UI Element
svg :: UI Element
switch :: UI Element
symbol :: UI Element
text :: UI Element
textPath :: UI Element
title :: UI Element
tref :: UI Element
tspan :: UI Element
use :: UI Element
view :: UI Element
vkern :: UI Element

module Graphics.UI.Threepenny.SVG.Attributes
accent_height :: WriteAttr Element Float
accumulate :: WriteAttr Element String
additive :: WriteAttr Element String
alphabetic :: WriteAttr Element Float
amplitude :: WriteAttr Element Float
arabic_form :: WriteAttr Element String
ascent :: WriteAttr Element Float
attributeName :: WriteAttr Element String
attributeType :: WriteAttr Element String
azimuth :: WriteAttr Element Float
baseFrequency :: WriteAttr Element String
baseProfile :: WriteAttr Element String
bbox :: WriteAttr Element String
begin :: WriteAttr Element String
bias :: WriteAttr Element Float
by :: WriteAttr Element Float
calcMode :: WriteAttr Element String
cap_height :: WriteAttr Element Float
class_ :: WriteAttr Element String
clipPathUnits :: WriteAttr Element String
contentScriptType :: WriteAttr Element String
contentStyleType :: WriteAttr Element String
cx :: WriteAttr Element String
cy :: WriteAttr Element String
d :: WriteAttr Element String
descent :: WriteAttr Element Float
diffuseConstant :: WriteAttr Element Float
divisor :: WriteAttr Element Float
dur :: WriteAttr Element String
dx :: WriteAttr Element String
dy :: WriteAttr Element String
edgeMode :: WriteAttr Element String
elevation :: WriteAttr Element Float
end :: WriteAttr Element String
exponent :: WriteAttr Element Float
externalResourcesRequired :: WriteAttr Element String
filterRes :: WriteAttr Element String
filterUnits :: WriteAttr Element String
format :: WriteAttr Element String
from :: WriteAttr Element Float
fx :: WriteAttr Element String
fy :: WriteAttr Element String
g1 :: WriteAttr Element String
g2 :: WriteAttr Element String
glyph_name :: WriteAttr Element String
glyphRef :: WriteAttr Element String
gradientTransform :: WriteAttr Element String
gradientUnits :: WriteAttr Element String
hanging :: WriteAttr Element Float
height :: WriteAttr Element String
horiz_adv_x :: WriteAttr Element Float
horiz_origin_x :: WriteAttr Element Float
horiz_origin_y :: WriteAttr Element Float
id :: WriteAttr Element String
ideographic :: WriteAttr Element Float
in_ :: WriteAttr Element String
in2 :: WriteAttr Element String
intercept :: WriteAttr Element Float
k :: WriteAttr Element Float
k1 :: WriteAttr Element Float
k2 :: WriteAttr Element Float
k3 :: WriteAttr Element Float
k4 :: WriteAttr Element Float
kernelMatrix :: WriteAttr Element String
kernelUnitLength :: WriteAttr Element String
keyPoints :: WriteAttr Element String
keySplines :: WriteAttr Element String
keyTimes :: WriteAttr Element String
lang :: WriteAttr Element String
lengthAdjust :: WriteAttr Element String
limitingConeAngle :: WriteAttr Element Float
local :: WriteAttr Element String
markerHeight :: WriteAttr Element String
markerUnits :: WriteAttr Element String
markerWidth :: WriteAttr Element String
maskContentUnits :: WriteAttr Element String
maskUnits :: WriteAttr Element String
mathematical :: WriteAttr Element Float
max :: WriteAttr Element String
media :: WriteAttr Element String
method :: WriteAttr Element String
min :: WriteAttr Element String
mode :: WriteAttr Element String
name :: WriteAttr Element String
numOctaves :: WriteAttr Element Int
offset :: WriteAttr Element Float
onabort :: WriteAttr Element String
onactivate :: WriteAttr Element String
onbegin :: WriteAttr Element String
onclick :: WriteAttr Element String
onend :: WriteAttr Element String
onerror :: WriteAttr Element String
onfocusin :: WriteAttr Element String
onfocusout :: WriteAttr Element String
onload :: WriteAttr Element String
onmousedown :: WriteAttr Element String
onmousemove :: WriteAttr Element String
onmouseout :: WriteAttr Element String
onmouseover :: WriteAttr Element String
onmouseup :: WriteAttr Element String
onrepeat :: WriteAttr Element String
onresize :: WriteAttr Element String
onscroll :: WriteAttr Element String
onunload :: WriteAttr Element String
onzoom :: WriteAttr Element String
operator :: WriteAttr Element String
order :: WriteAttr Element String
orient :: WriteAttr Element String
orientation :: WriteAttr Element String
origin :: WriteAttr Element String
overline_position :: WriteAttr Element Float
overline_thickness :: WriteAttr Element Float
panose_1 :: WriteAttr Element Int
path :: [Char]
pathLength :: WriteAttr Element Float
patternContentUnits :: WriteAttr Element String
patternTransform :: WriteAttr Element String
patternUnits :: WriteAttr Element String
points :: WriteAttr Element String
pointsAtX :: WriteAttr Element Float
pointsAtY :: WriteAttr Element Float
pointsAtZ :: WriteAttr Element Float
preserveAlpha :: WriteAttr Element String
preserveAspectRatio :: WriteAttr Element String
primitiveUnits :: WriteAttr Element String
r :: WriteAttr Element String
radius :: WriteAttr Element String
refX :: WriteAttr Element String
refY :: WriteAttr Element String
rendering_intent :: WriteAttr Element String
repeatCount :: WriteAttr Element String
repeatDur :: WriteAttr Element String
requiredExtensions :: WriteAttr Element String
requiredFeatures :: WriteAttr Element String
restart :: WriteAttr Element String
result :: WriteAttr Element String
rotate :: WriteAttr Element String
rx :: WriteAttr Element String
ry :: WriteAttr Element String
scale :: WriteAttr Element Float
seed :: WriteAttr Element Float
slope :: WriteAttr Element Float
spacing :: WriteAttr Element String
specularConstant :: WriteAttr Element Float
specularExponent :: WriteAttr Element Float
spreadMethod :: WriteAttr Element String
startOffset :: WriteAttr Element String
stdDeviation :: WriteAttr Element String
stemh :: WriteAttr Element Float
stemv :: WriteAttr Element Float
stitchTiles :: WriteAttr Element String
strikethrough_position :: WriteAttr Element Float
strikethrough_thickness :: WriteAttr Element Float
string :: WriteAttr Element String
style :: WriteAttr Element String
surfaceScale :: WriteAttr Element Float
systemLanguage :: WriteAttr Element String
tableValues :: WriteAttr Element String
target :: WriteAttr Element String
targetX :: WriteAttr Element Float
targetY :: WriteAttr Element Float
textLength :: WriteAttr Element String
title :: WriteAttr Element String
to :: WriteAttr Element Float
transform :: WriteAttr Element String
type_ :: WriteAttr Element String
u1 :: WriteAttr Element String
u2 :: WriteAttr Element String
underline_position :: WriteAttr Element Float
underline_thickness :: WriteAttr Element Float
unicode :: WriteAttr Element String
unicode_range :: WriteAttr Element String
units_per_em :: WriteAttr Element Float
v_alphabetic :: WriteAttr Element Float
v_hanging :: WriteAttr Element Float
v_ideographic :: WriteAttr Element Float
v_mathematical :: WriteAttr Element Float
values :: WriteAttr Element String
version :: WriteAttr Element Float
vert_adv_y :: WriteAttr Element Float
vert_origin_x :: WriteAttr Element Float
vert_origin_y :: WriteAttr Element Float
viewBox :: WriteAttr Element String
viewTarget :: WriteAttr Element String
width :: WriteAttr Element String
widths :: WriteAttr Element String
x :: WriteAttr Element String
x_height :: WriteAttr Element Float
x1 :: WriteAttr Element String
x2 :: WriteAttr Element String
xChannelSelector :: WriteAttr Element String
xlink_actuate :: WriteAttr Element String
xlink_arcrole :: WriteAttr Element String
xlink_href :: WriteAttr Element String
xlink_role :: WriteAttr Element String
xlink_show :: WriteAttr Element String
xlink_title :: WriteAttr Element String
xlink_type :: WriteAttr Element String
xml_base :: WriteAttr Element String
xml_lang :: WriteAttr Element String
xml_space :: WriteAttr Element String
y :: WriteAttr Element String
y1 :: WriteAttr Element String
y2 :: WriteAttr Element String
yChannelSelector :: WriteAttr Element String
z :: WriteAttr Element Float
zoomAndPan :: WriteAttr Element String

-- | <i>Deprecated: Use <a>refX</a> and <a>refY</a> instead</i>
refx :: WriteAttr Element String

-- | <i>Deprecated: Use <a>refX</a> and <a>refY</a> instead</i>
refy :: WriteAttr Element String
alignment_baseline :: WriteAttr Element String
baseline_shift :: WriteAttr Element String
clip_path :: WriteAttr Element String
clip_rule :: WriteAttr Element String
clip :: WriteAttr Element String
color_interpolation_filters :: WriteAttr Element String
color_interpolation :: WriteAttr Element String
color_profile :: WriteAttr Element String
color_rendering :: WriteAttr Element String
color :: WriteAttr Element String
cursor :: WriteAttr Element String
direction :: WriteAttr Element String
display :: WriteAttr Element String
dominant_baseline :: WriteAttr Element String
enable_background :: WriteAttr Element String
fill_opacity :: WriteAttr Element String
fill_rule :: WriteAttr Element String
fill :: WriteAttr Element String
filter :: WriteAttr Element String
flood_color :: WriteAttr Element String
flood_opacity :: WriteAttr Element String
font_family :: WriteAttr Element String
font_size_adjust :: WriteAttr Element String
font_size :: WriteAttr Element String
font_stretch :: WriteAttr Element String
font_style :: WriteAttr Element String
font_variant :: WriteAttr Element String
font_weight :: WriteAttr Element String
glyph_orientation_horizontal :: WriteAttr Element String
glyph_orientation_vertical :: WriteAttr Element String
image_rendering :: WriteAttr Element String
kerning :: WriteAttr Element String
letter_spacing :: WriteAttr Element String
lighting_color :: WriteAttr Element String
marker_end :: WriteAttr Element String
marker_mid :: WriteAttr Element String
marker_start :: WriteAttr Element String
mask :: WriteAttr Element String
opacity :: WriteAttr Element String
overflow :: WriteAttr Element String
pointer_events :: WriteAttr Element String
shape_rendering :: WriteAttr Element String
stop_color :: WriteAttr Element String
stop_opacity :: WriteAttr Element String
stroke_dasharray :: WriteAttr Element String
stroke_dashoffset :: WriteAttr Element String
stroke_linecap :: WriteAttr Element String
stroke_linejoin :: WriteAttr Element String
stroke_miterlimit :: WriteAttr Element String
stroke_opacity :: WriteAttr Element String
stroke_width :: WriteAttr Element String
stroke :: WriteAttr Element String
text_anchor :: WriteAttr Element String
text_decoration :: WriteAttr Element String
text_rendering :: WriteAttr Element String
unicode_bidi :: WriteAttr Element String
visibility :: WriteAttr Element String
word_spacing :: WriteAttr Element String
writing_mode :: WriteAttr Element String

module Graphics.UI.Threepenny.SVG
accent_height :: WriteAttr Element Float
accumulate :: WriteAttr Element String
additive :: WriteAttr Element String
alignment_baseline :: WriteAttr Element String
alphabetic :: WriteAttr Element Float
amplitude :: WriteAttr Element Float
arabic_form :: WriteAttr Element String
ascent :: WriteAttr Element Float
attributeName :: WriteAttr Element String
attributeType :: WriteAttr Element String
azimuth :: WriteAttr Element Float
baseFrequency :: WriteAttr Element String
baseProfile :: WriteAttr Element String
baseline_shift :: WriteAttr Element String
bbox :: WriteAttr Element String
begin :: WriteAttr Element String
bias :: WriteAttr Element Float
by :: WriteAttr Element Float
calcMode :: WriteAttr Element String
cap_height :: WriteAttr Element Float
class_ :: WriteAttr Element String
clip :: WriteAttr Element String
clip_path :: WriteAttr Element String
clip_rule :: WriteAttr Element String
clipPathUnits :: WriteAttr Element String
color :: WriteAttr Element String
color_interpolation :: WriteAttr Element String
color_interpolation_filters :: WriteAttr Element String
color_profile :: WriteAttr Element String
color_rendering :: WriteAttr Element String
contentScriptType :: WriteAttr Element String
contentStyleType :: WriteAttr Element String
cursor :: WriteAttr Element String
cx :: WriteAttr Element String
cy :: WriteAttr Element String
d :: WriteAttr Element String
descent :: WriteAttr Element Float
diffuseConstant :: WriteAttr Element Float
direction :: WriteAttr Element String
display :: WriteAttr Element String
divisor :: WriteAttr Element Float
dominant_baseline :: WriteAttr Element String
dur :: WriteAttr Element String
dx :: WriteAttr Element String
dy :: WriteAttr Element String
edgeMode :: WriteAttr Element String
elevation :: WriteAttr Element Float
enable_background :: WriteAttr Element String
end :: WriteAttr Element String
exponent :: WriteAttr Element Float
externalResourcesRequired :: WriteAttr Element String
fill :: WriteAttr Element String
fill_opacity :: WriteAttr Element String
fill_rule :: WriteAttr Element String
filter :: WriteAttr Element String
filterRes :: WriteAttr Element String
filterUnits :: WriteAttr Element String
flood_color :: WriteAttr Element String
flood_opacity :: WriteAttr Element String
font_family :: WriteAttr Element String
font_size :: WriteAttr Element String
font_size_adjust :: WriteAttr Element String
font_stretch :: WriteAttr Element String
font_style :: WriteAttr Element String
font_variant :: WriteAttr Element String
font_weight :: WriteAttr Element String
format :: WriteAttr Element String
from :: WriteAttr Element Float
fx :: WriteAttr Element String
fy :: WriteAttr Element String
g1 :: WriteAttr Element String
g2 :: WriteAttr Element String
glyph_name :: WriteAttr Element String
glyph_orientation_horizontal :: WriteAttr Element String
glyph_orientation_vertical :: WriteAttr Element String
gradientTransform :: WriteAttr Element String
gradientUnits :: WriteAttr Element String
hanging :: WriteAttr Element Float
height :: WriteAttr Element String
horiz_adv_x :: WriteAttr Element Float
horiz_origin_x :: WriteAttr Element Float
horiz_origin_y :: WriteAttr Element Float
id :: WriteAttr Element String
ideographic :: WriteAttr Element Float
image_rendering :: WriteAttr Element String
in_ :: WriteAttr Element String
in2 :: WriteAttr Element String
intercept :: WriteAttr Element Float
k :: WriteAttr Element Float
k1 :: WriteAttr Element Float
k2 :: WriteAttr Element Float
k3 :: WriteAttr Element Float
k4 :: WriteAttr Element Float
kernelMatrix :: WriteAttr Element String
kernelUnitLength :: WriteAttr Element String
kerning :: WriteAttr Element String
keyPoints :: WriteAttr Element String
keySplines :: WriteAttr Element String
keyTimes :: WriteAttr Element String
lang :: WriteAttr Element String
lengthAdjust :: WriteAttr Element String
letter_spacing :: WriteAttr Element String
lighting_color :: WriteAttr Element String
limitingConeAngle :: WriteAttr Element Float
local :: WriteAttr Element String
marker_end :: WriteAttr Element String
marker_mid :: WriteAttr Element String
marker_start :: WriteAttr Element String
markerHeight :: WriteAttr Element String
markerUnits :: WriteAttr Element String
markerWidth :: WriteAttr Element String
mask :: WriteAttr Element String
maskContentUnits :: WriteAttr Element String
maskUnits :: WriteAttr Element String
mathematical :: WriteAttr Element Float
max :: WriteAttr Element String
media :: WriteAttr Element String
method :: WriteAttr Element String
min :: WriteAttr Element String
mode :: WriteAttr Element String
name :: WriteAttr Element String
numOctaves :: WriteAttr Element Int
offset :: WriteAttr Element Float
onabort :: WriteAttr Element String
onactivate :: WriteAttr Element String
onbegin :: WriteAttr Element String
onclick :: WriteAttr Element String
onend :: WriteAttr Element String
onerror :: WriteAttr Element String
onfocusin :: WriteAttr Element String
onfocusout :: WriteAttr Element String
onload :: WriteAttr Element String
onmousedown :: WriteAttr Element String
onmousemove :: WriteAttr Element String
onmouseout :: WriteAttr Element String
onmouseover :: WriteAttr Element String
onmouseup :: WriteAttr Element String
onrepeat :: WriteAttr Element String
onresize :: WriteAttr Element String
onscroll :: WriteAttr Element String
onunload :: WriteAttr Element String
onzoom :: WriteAttr Element String
opacity :: WriteAttr Element String
operator :: WriteAttr Element String
order :: WriteAttr Element String
orient :: WriteAttr Element String
orientation :: WriteAttr Element String
origin :: WriteAttr Element String
overflow :: WriteAttr Element String
overline_position :: WriteAttr Element Float
overline_thickness :: WriteAttr Element Float
panose_1 :: WriteAttr Element Int
pathLength :: WriteAttr Element Float
patternContentUnits :: WriteAttr Element String
patternTransform :: WriteAttr Element String
patternUnits :: WriteAttr Element String
pointer_events :: WriteAttr Element String
points :: WriteAttr Element String
pointsAtX :: WriteAttr Element Float
pointsAtY :: WriteAttr Element Float
pointsAtZ :: WriteAttr Element Float
preserveAlpha :: WriteAttr Element String
preserveAspectRatio :: WriteAttr Element String
primitiveUnits :: WriteAttr Element String
r :: WriteAttr Element String
radius :: WriteAttr Element String
refX :: WriteAttr Element String
refY :: WriteAttr Element String

-- | <i>Deprecated: Use <a>refX</a> and <a>refY</a> instead</i>
refx :: WriteAttr Element String

-- | <i>Deprecated: Use <a>refX</a> and <a>refY</a> instead</i>
refy :: WriteAttr Element String
rendering_intent :: WriteAttr Element String
repeatCount :: WriteAttr Element String
repeatDur :: WriteAttr Element String
requiredExtensions :: WriteAttr Element String
requiredFeatures :: WriteAttr Element String
restart :: WriteAttr Element String
result :: WriteAttr Element String
rotate :: WriteAttr Element String
rx :: WriteAttr Element String
ry :: WriteAttr Element String
scale :: WriteAttr Element Float
seed :: WriteAttr Element Float
shape_rendering :: WriteAttr Element String
slope :: WriteAttr Element Float
spacing :: WriteAttr Element String
specularConstant :: WriteAttr Element Float
specularExponent :: WriteAttr Element Float
spreadMethod :: WriteAttr Element String
startOffset :: WriteAttr Element String
stdDeviation :: WriteAttr Element String
stemh :: WriteAttr Element Float
stemv :: WriteAttr Element Float
stitchTiles :: WriteAttr Element String
stop_color :: WriteAttr Element String
stop_opacity :: WriteAttr Element String
strikethrough_position :: WriteAttr Element Float
strikethrough_thickness :: WriteAttr Element Float
string :: WriteAttr Element String
stroke :: WriteAttr Element String
stroke_dasharray :: WriteAttr Element String
stroke_dashoffset :: WriteAttr Element String
stroke_linecap :: WriteAttr Element String
stroke_linejoin :: WriteAttr Element String
stroke_miterlimit :: WriteAttr Element String
stroke_opacity :: WriteAttr Element String
stroke_width :: WriteAttr Element String
style :: WriteAttr Element String
surfaceScale :: WriteAttr Element Float
systemLanguage :: WriteAttr Element String
tableValues :: WriteAttr Element String
target :: WriteAttr Element String
targetX :: WriteAttr Element Float
targetY :: WriteAttr Element Float
text_anchor :: WriteAttr Element String
text_decoration :: WriteAttr Element String
text_rendering :: WriteAttr Element String
textLength :: WriteAttr Element String
to :: WriteAttr Element Float
transform :: WriteAttr Element String
type_ :: WriteAttr Element String
u1 :: WriteAttr Element String
u2 :: WriteAttr Element String
underline_position :: WriteAttr Element Float
underline_thickness :: WriteAttr Element Float
unicode :: WriteAttr Element String
unicode_bidi :: WriteAttr Element String
unicode_range :: WriteAttr Element String
units_per_em :: WriteAttr Element Float
v_alphabetic :: WriteAttr Element Float
v_hanging :: WriteAttr Element Float
v_ideographic :: WriteAttr Element Float
v_mathematical :: WriteAttr Element Float
values :: WriteAttr Element String
version :: WriteAttr Element Float
vert_adv_y :: WriteAttr Element Float
vert_origin_x :: WriteAttr Element Float
vert_origin_y :: WriteAttr Element Float
viewBox :: WriteAttr Element String
viewTarget :: WriteAttr Element String
visibility :: WriteAttr Element String
width :: WriteAttr Element String
widths :: WriteAttr Element String
word_spacing :: WriteAttr Element String
writing_mode :: WriteAttr Element String
x :: WriteAttr Element String
x_height :: WriteAttr Element Float
x1 :: WriteAttr Element String
x2 :: WriteAttr Element String
xChannelSelector :: WriteAttr Element String
xlink_actuate :: WriteAttr Element String
xlink_arcrole :: WriteAttr Element String
xlink_href :: WriteAttr Element String
xlink_role :: WriteAttr Element String
xlink_show :: WriteAttr Element String
xlink_title :: WriteAttr Element String
xlink_type :: WriteAttr Element String
xml_base :: WriteAttr Element String
xml_lang :: WriteAttr Element String
xml_space :: WriteAttr Element String
y :: WriteAttr Element String
y1 :: WriteAttr Element String
y2 :: WriteAttr Element String
yChannelSelector :: WriteAttr Element String
z :: WriteAttr Element Float
zoomAndPan :: WriteAttr Element String
a :: UI Element
altGlyph :: UI Element
altGlyphDef :: UI Element
altGlyphItem :: UI Element
animate :: UI Element
animateColor :: UI Element
animateMotion :: UI Element
animateTransform :: UI Element
circle :: UI Element
clipPath :: UI Element
colorProfile :: UI Element
defs :: UI Element
desc :: UI Element
ellipse :: UI Element
feBlend :: UI Element
feColorMatrix :: UI Element
feComponentTransfer :: UI Element
feComposite :: UI Element
feConvolveMatrix :: UI Element
feDiffuseLighting :: UI Element
feDisplacementMap :: UI Element
feDistantLight :: UI Element
feFlood :: UI Element
feFuncA :: UI Element
feFuncB :: UI Element
feFuncG :: UI Element
feFuncR :: UI Element
feGaussianBlur :: UI Element
feImage :: UI Element
feMerge :: UI Element
feMergeNode :: UI Element
feMorphology :: UI Element
feOffset :: UI Element
fePointLight :: UI Element
feSpecularLighting :: UI Element
feSpotLight :: UI Element
feTile :: UI Element
feTurbulence :: UI Element
font :: UI Element
font_face :: UI Element
font_face_format :: UI Element
font_face_name :: UI Element
font_face_srv :: UI Element
font_face_uri :: UI Element
foreignObject :: UI Element
g :: UI Element
glyph :: UI Element
glyphRef :: UI Element
hkern :: UI Element
image :: UI Element
line :: UI Element
linearGradient :: UI Element
marker :: UI Element
metadata :: UI Element
missing_glyph :: UI Element
mpath :: UI Element
path :: UI Element
pattern :: UI Element
polygon :: UI Element
polyline :: UI Element
radialGradient :: UI Element
rect :: UI Element
script :: UI Element
set :: UI Element
stop :: UI Element
svg :: UI Element
switch :: UI Element
symbol :: UI Element
text :: UI Element
textPath :: UI Element
title :: UI Element
tref :: UI Element
tspan :: UI Element
use :: UI Element
view :: UI Element
vkern :: UI Element

module Graphics.UI.Threepenny.JQuery
data Easing
Swing :: Easing
Linear :: Easing

-- | Fade in an element.
fadeIn :: Element -> Int -> Easing -> IO () -> UI ()

-- | Fade out an element.
fadeOut :: Element -> Int -> Easing -> IO () -> UI ()

-- | The <a>sendValue</a> event happens whenever the return key is pressed
--   while the element has focus. Its data is the event value.
sendValue :: Element -> Event String

-- | Focus an element.
setFocus :: Element -> UI ()

-- | Scroll to the bottom of an element.
scrollToBottom :: Element -> UI ()
instance GHC.Show.Show Graphics.UI.Threepenny.JQuery.Easing
instance GHC.Enum.Enum Graphics.UI.Threepenny.JQuery.Easing
instance GHC.Classes.Eq Graphics.UI.Threepenny.JQuery.Easing
instance Data.Default.Class.Default Graphics.UI.Threepenny.JQuery.Easing


-- | Predefined DOM elements, for convenience.
module Graphics.UI.Threepenny.Elements

-- | Add a stylesheet to the head.
--   
--   The second argument refers to the filename of the stylesheet, but not
--   its complete filepath. Threepenny will prefix the <tt>css</tt>
--   subdirectory of the <tt>tpStatic</tt> configuration field to construct
--   the complete filepath.
addStyleSheet :: Window -> FilePath -> UI ()

-- | Make a new <tt>div</tt> element, synonym for <a>div</a>.
new :: UI Element
address :: UI Element
a :: UI Element
anchor :: UI Element
applet :: UI Element
area :: UI Element
audio :: UI Element
basefont :: UI Element
big :: UI Element
blockquote :: UI Element
body :: UI Element
bold :: UI Element
br :: UI Element
button :: UI Element
canvas :: UI Element
caption :: UI Element
center :: UI Element
cite :: UI Element
code :: UI Element
ddef :: UI Element
define :: UI Element
div :: UI Element
dlist :: UI Element
dterm :: UI Element
emphasize :: UI Element
fieldset :: UI Element
font :: UI Element
form :: UI Element
frame :: UI Element
frameset :: UI Element
h1 :: UI Element
h2 :: UI Element
h3 :: UI Element
h4 :: UI Element
h5 :: UI Element
h6 :: UI Element
header :: UI Element
hr :: UI Element
img :: UI Element
image :: UI Element
input :: UI Element
italics :: UI Element
keyboard :: UI Element
label :: UI Element
legend :: UI Element
li :: UI Element
link :: UI Element
map :: UI Element
meta :: UI Element
noframes :: UI Element
olist :: UI Element
option :: UI Element
p :: UI Element
paragraph :: UI Element
param :: UI Element
pre :: UI Element
sample :: UI Element
select :: UI Element
small :: UI Element
source :: UI Element
span :: UI Element
strong :: UI Element
sub :: UI Element
sup :: UI Element
table :: UI Element
td :: UI Element
textarea :: UI Element
th :: UI Element
thebase :: UI Element
thehtml :: UI Element
title_ :: UI Element
tr :: UI Element
tt :: UI Element
ul :: UI Element
underline :: UI Element
variable :: UI Element
video :: UI Element

module Graphics.UI.Threepenny.DragNDrop

-- | Enable or disable whether the element can be dragged by the user.
--   
--   An element with draggable set to <a>True</a> will receive <a>drag</a>,
--   <a>dragStart</a> and <a>dragEnd</a> events.
draggable :: WriteAttr Element Bool

-- | Enable or disable whether the element accepts drops.
--   
--   An element with <a>droppable</a> set to <a>True</a> will receive
--   <a>drop</a>, <a>dragOver</a>, <a>dragEnter</a> and <a>dragLeave</a>
--   events.
--   
--   Child elements of a <a>droppable</a> element may also be
--   <a>droppable</a>. When dragging something over an element, the closest
--   ancestor element that is <a>droppable</a> will be the target and
--   receive corresponding events.
droppable :: WriteAttr Element Bool

-- | Set the data that is transferred when dragging this element.
dragData :: WriteAttr Element DragData

-- | Data carried by a dragged element.
--   
--   FIXME: Empty data is currently encoded by the empty String. Change
--   this to 'Maybe String' instead.
type DragData = String

-- | Occurs periodically while the element is being dragged around.
drag :: Element -> Event DragData

-- | Dragging the element starts.
dragStart :: Element -> Event DragData

-- | Dragging the element ends.
--   
--   WARNING: This event can occur both before and after a corresponding
--   <a>drop</a> event.
dragEnd :: Element -> Event DragData

-- | The drag and drop operation is being completed on this element.
drop :: Element -> Event DragData

-- | The element is now the current target element for a <a>drop</a>.
--   
--   WARNING: This element is buggy when moving the mouse over child
--   elements.
dragEnter :: Element -> Event DragData

-- | The element is no longer the current target element for a <a>drop</a>.
--   
--   WARNING: This event is also fired when the mouse is moved over a child
--   element.
dragLeave :: Element -> Event DragData

-- | Occurs periodically while the element is the current target element.
dragOver :: Element -> Event DragData

module Graphics.UI.Threepenny.Canvas
type Canvas = Element
type Vector = Point
type Point = (Double, Double)
data Color
RGB :: Int -> Int -> Int -> Color
[red] :: Color -> Int
[green] :: Color -> Int
[blue] :: Color -> Int
RGBA :: Int -> Int -> Int -> Double -> Color
[red] :: Color -> Int
[green] :: Color -> Int
[blue] :: Color -> Int
[alpha] :: Color -> Double
type ColorStop = (Double, Color)
data Gradient
data FillStyle

-- | Draw the image of an image element onto the canvas at a specified
--   position.
drawImage :: Element -> Vector -> Canvas -> UI ()

-- | Clear the canvas
clearCanvas :: Canvas -> UI ()

-- | creates a solid-color fillstyle
solidColor :: Color -> FillStyle

-- | Solid color represented as a HTML string.
htmlColor :: String -> FillStyle

-- | creates a linear gradient fill style
linearGradient :: Point -> Double -> Double -> [ColorStop] -> FillStyle

-- | creates a simple horizontal gradient
horizontalLinearGradient :: Point -> Double -> Color -> Color -> FillStyle

-- | creates a simple vertical gradient
verticalLinearGradient :: Point -> Double -> Color -> Color -> FillStyle

-- | Draw a filled rectangle.
--   
--   The <a>fillStyle</a> attribute determines the color.
fillRect :: Point -> Double -> Double -> Canvas -> UI ()

-- | The Fillstyle to use inside shapes. write-only as I could not find how
--   to consistently read the fillstyle
fillStyle :: WriteAttr Canvas FillStyle

-- | The color or style to use for the lines around shapes. Default is
--   <tt>#000</tt> (black).
strokeStyle :: Attr Canvas String

-- | The width of lines. Default is <tt>1</tt>.
lineWidth :: Attr Canvas Double

-- | The font used for <a>fillText</a> and <a>strokeText</a>. Default is
--   <tt>10px sans-serif</tt>.
textFont :: Attr Canvas String
data TextAlign
Start :: TextAlign
End :: TextAlign
LeftAligned :: TextAlign
RightAligned :: TextAlign
Center :: TextAlign

-- | The alignment for <a>fillText</a> and <a>strokeText</a>. Default is
--   <a>Start</a>.
textAlign :: Attr Canvas TextAlign

-- | Starts a new path by resetting the list of sub-paths. Call this
--   function when you want to create a new path.
beginPath :: Canvas -> UI ()

-- | Moves the starting point of a new subpath to the <tt>(x,y)</tt>
--   coordinate.
moveTo :: Point -> Canvas -> UI ()

-- | Connects the last point in the subpath to the <tt>(x,y)</tt>
--   coordinates with a straight line.
lineTo :: Point -> Canvas -> UI ()

-- | Draw a straight line from the current point to the start of the path.
--   If the shape has already been closed or has only one point, this
--   function does nothing.
closePath :: Canvas -> UI ()

-- | Add a circular arc to the current path.
arc :: Point -> Double -> Double -> Double -> Canvas -> UI ()

-- | Like <a>arc</a>, but with an extra argument that indicates whether we
--   go in counter-clockwise (<a>True</a>) or clockwise (<a>False</a>)
--   direction.
arc' :: Point -> Double -> Double -> Double -> Bool -> Canvas -> UI ()

-- | Fills the subpaths with the current fill style.
fill :: Canvas -> UI ()

-- | Strokes the subpaths with the current stroke style.
stroke :: Canvas -> UI ()

-- | Render a text in solid color at a certain point on the canvas.
--   
--   The <a>fillStyle</a> attribute determines the color. The
--   <a>textFont</a> attribute determines the font used. The
--   <a>textAlign</a> attributes determines the position of the text
--   relative to the point.
fillText :: String -> Point -> Canvas -> UI ()

-- | Render the outline of a text at a certain point on the canvas.
--   
--   The <a>strokeStyle</a> attribute determines the color of the outline.
--   The <a>textFont</a> attribute determines the font used. The
--   <a>textAlign</a> attributes determines the position of the text
--   relative to the point.
strokeText :: String -> Point -> Canvas -> UI ()
instance GHC.Show.Show Graphics.UI.Threepenny.Canvas.Color
instance GHC.Classes.Eq Graphics.UI.Threepenny.Canvas.Color
instance GHC.Classes.Eq Graphics.UI.Threepenny.Canvas.Gradient
instance GHC.Show.Show Graphics.UI.Threepenny.Canvas.Gradient
instance GHC.Classes.Eq Graphics.UI.Threepenny.Canvas.FillStyle
instance GHC.Show.Show Graphics.UI.Threepenny.Canvas.FillStyle
instance GHC.Read.Read Graphics.UI.Threepenny.Canvas.TextAlign
instance GHC.Show.Show Graphics.UI.Threepenny.Canvas.TextAlign
instance GHC.Classes.Eq Graphics.UI.Threepenny.Canvas.TextAlign

module Graphics.UI.Threepenny.Attributes

-- | The <tt>checked</tt> status of an input element of type checkbox.
checked :: Attr Element Bool

-- | Index of the currently selected option of a <tt><a>select</a></tt>
--   element.
--   
--   The index starts at <tt>0</tt>. If no option is selected, then the
--   selection is <a>Nothing</a>.
selection :: Attr Element (Maybe Int)

-- | The <tt>enabled</tt> status of an input element
enabled :: Attr Element Bool
action :: WriteAttr Element String
align :: WriteAttr Element String
alink :: WriteAttr Element String
alt :: WriteAttr Element String
altcode :: WriteAttr Element String
archive :: WriteAttr Element String
background :: WriteAttr Element String
base :: WriteAttr Element String
bgcolor :: WriteAttr Element String
border :: WriteAttr Element Int
bordercolor :: WriteAttr Element String
cellpadding :: WriteAttr Element Int
cellspacing :: WriteAttr Element Int
checked_ :: WriteAttr Element Bool
class_ :: WriteAttr Element String
clear_ :: WriteAttr Element String
code_ :: WriteAttr Element String
codebase :: WriteAttr Element String
color :: WriteAttr Element String
cols :: WriteAttr Element String
colspan :: WriteAttr Element Int
compact :: WriteAttr Element Bool
content :: WriteAttr Element String
coords :: WriteAttr Element String
enctype :: WriteAttr Element String
face :: WriteAttr Element String
for :: WriteAttr Element String
frameborder :: WriteAttr Element Int
height :: WriteAttr Element Int
href :: WriteAttr Element String
hspace :: WriteAttr Element Int
httpequiv :: WriteAttr Element String
id_ :: WriteAttr Element String
ismap :: WriteAttr Element Bool
lang :: WriteAttr Element String
marginheight :: WriteAttr Element Int
marginwidth :: WriteAttr Element Int
maxlength :: WriteAttr Element Int
method :: WriteAttr Element String
multiple :: WriteAttr Element Bool
name :: WriteAttr Element String
nohref :: WriteAttr Element Bool
noresize :: WriteAttr Element Bool
noshade :: WriteAttr Element Bool
nowrap :: WriteAttr Element Bool
rel :: WriteAttr Element String
rev :: WriteAttr Element String
rows :: WriteAttr Element String
rowspan :: WriteAttr Element Int
rules :: WriteAttr Element String
scrolling :: WriteAttr Element String
selected :: WriteAttr Element Bool
shape :: WriteAttr Element String
size :: WriteAttr Element String
src :: WriteAttr Element String
target :: WriteAttr Element String
text_ :: WriteAttr Element String
title__ :: WriteAttr Element String
type_ :: WriteAttr Element String
usemap :: WriteAttr Element String
valign :: WriteAttr Element String
version :: WriteAttr Element String
vlink :: WriteAttr Element String
vspace :: WriteAttr Element Int
width :: WriteAttr Element Int

module Graphics.UI.Threepenny.Events

-- | Event that occurs when the <i>user</i> changes the value of the input
--   element.
valueChange :: Element -> Event String

-- | Event that occurs when the <i>user</i> changes the selection of a
--   <tt><a>select</a></tt> element.
selectionChange :: Element -> Event (Maybe Int)

-- | Event that occurs when the <i>user</i> changes the checked status of
--   an input element of type checkbox.
checkedChange :: Element -> Event Bool

-- | Mouse click.
click :: Element -> Event ()

-- | Context menu event.
--   
--   The mouse coordinates are relative to the upper left corner of the
--   element.
contextmenu :: Element -> Event (Double, Double)

-- | Event that periodically occurs while the mouse is moving over an
--   element.
--   
--   The event value represents the mouse coordinates relative to the upper
--   left corner of the element.
--   
--   Note: The <tt><a>body</a></tt> element responds to mouse move events,
--   but only in the area occupied by actual content, not the whole browser
--   window.
mousemove :: Element -> Event (Double, Double)

-- | Mouse down event.
--   
--   The mouse coordinates are relative to the upper left corner of the
--   element.
mousedown :: Element -> Event (Double, Double)

-- | Mouse up event.
--   
--   The mouse coordinates are relative to the upper left corner of the
--   element.
mouseup :: Element -> Event (Double, Double)

-- | Mouse enters an element.
hover :: Element -> Event ()

-- | Mouse leaving an element.
leave :: Element -> Event ()

-- | Element receives focus.
focus :: Element -> Event ()

-- | Element loses focus.
blur :: Element -> Event ()
type KeyCode = Int

-- | Key released while element has focus.
keyup :: Element -> Event KeyCode

-- | Key pressed while element has focus. Returns the keycode (as opposed
--   to the ASCII value) of any key, including SHIFT, CTRL and arrow keys.
keydown :: Element -> Event KeyCode

-- | Key pressed while element has focus. Returns the actual character,
--   taking into account SHIFT or CAPS LOCK.
keypress :: Element -> Event Char

-- | Round a pair of <a>Double</a> to the next integers. This function
--   helps you migrate from previous versions of Threepenny-GUI.
--   
--   The return types of mouse events (<a>mousedown</a>, <a>mouseup</a>,
--   <a>mousemove</a>, <a>contextmenu</a>) have been redefined from
--   <tt>long</tt> to <tt>double</tt> in the CSS Object Model View Model
--   working draft, which browsers have begun to adopt.
--   
--   See
--   <a>https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent#Specifications</a>
--   
--   and
--   <a>https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX</a>
roundCoordinates :: (Double, Double) -> (Int, Int)

module Graphics.UI.Threepenny.Widgets

-- | Data type representing a behavior (<a>facts</a>) and suggestions to
--   change it (<a>rumors</a>).
data Tidings a
rumors :: Tidings a -> Event a
facts :: Tidings a -> Behavior a

-- | Smart constructor. Combine facts and rumors into <a>Tidings</a>.
tidings :: Behavior a -> Event a -> Tidings a

-- | A single-line text entry.
data TextEntry

-- | Create a single-line text entry.
entry :: Behavior String -> UI TextEntry

-- | User changes to the text value.
userText :: TextEntry -> Tidings String

-- | A list of values. The user can select entries.
data ListBox a

-- | Create a <a>ListBox</a>.
listBox :: forall a. Ord a => Behavior [a] -> Behavior (Maybe a) -> Behavior (a -> UI Element) -> UI (ListBox a)

-- | User changes to the current selection (possibly empty).
userSelection :: ListBox a -> Tidings (Maybe a)
instance Graphics.UI.Threepenny.Core.Widget (Graphics.UI.Threepenny.Widgets.ListBox a)
instance Graphics.UI.Threepenny.Core.Widget Graphics.UI.Threepenny.Widgets.TextEntry

module Graphics.UI.Threepenny
