sindre-0.4: A programming language for simple GUIs

Safe HaskellNone



Definitions for the Sindre runtime environment.



data Sindre m a Source

The main monad in which a Sindre program executes. More specialised monads, such as Execution are used for specific purposes, but they all run on top of the Sindre monad.

execSindre :: MonadBackend m => SindreEnv m -> Sindre m a -> m ExitCodeSource

execSindre e m executes the action m in environment e, returning the exit code of m.

quitSindre :: MonadBackend m => ExitCode -> Sindre m ()Source

Immediately return from execSindre, returning the given exit code.

class (MonadBackend im, Monad (m im)) => MonadSindre im m whereSource

MonadSindre im m is the class of monads m that run on top of Sindre with backend im, and can thus access Sindre functionality.


sindre :: Sindre im a -> m im aSource

Lift a Sindre operation into this monad.

back :: im a -> m im aSource

Lift a backend operation into this monad.

class (MonadIO m, Functor m, Applicative m, Mold (RootPosition m)) => MonadBackend m whereSource

A monad that can be used as the layer beneath Sindre.

Associated Types

type BackEvent m :: *Source

type RootPosition m :: *Source

data NewObject im Source

Container describing a newly created object.

newObject :: s -> Map Identifier (Method s im) -> [Field s im] -> (Event -> ObjectM s im ()) -> NewObject imSource

data NewWidget im Source

Container describing a newly created widget.

newWidget :: s -> Map Identifier (Method s im) -> [Field s im] -> (Event -> ObjectM s im ()) -> ObjectM s im SpaceNeed -> (Rectangle -> ObjectM s im SpaceUse) -> NewWidget imSource

data FieldDesc s im v Source

A typed description of a field, which may be read-write or read-only. When constructing the actual widget, you must turn these into real Fields by using the field function. A description of a field consists of a name and monadic actions for reading and optionally writing to the field.


ReadWriteField Identifier (ObjectM s im v) (v -> ObjectM s im ()) 
ReadOnlyField Identifier (ObjectM s im v) 

getField :: FieldDesc s im v -> ObjectM s im vSource

field :: Mold v => FieldDesc s im v -> Field s imSource

Turn a Haskell-typed high-level field description into a Value-typed field.

data Field s im Source

An opaque notion of a field. These are for internal use in the Sindre runtime.

type Method s im = [Value] -> ObjectM s im ValueSource

A method takes as arguments a list of Values and returns another Value. You probably do not want to call these directly from Haskell code, as they are dynamically typed. See function for a convenient way to turn a Haskell function into a suitable method.

data ObjectM s im a Source