Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Widget f z
- data WidgetFocus f z
- zipW :: (Functor f, Functor g, Functor h) => (f (OutputFn h z) -> g (OutputFn h z) -> h (OutputFn h z)) -> Widget f z -> Widget g z -> Widget h z
- graphicWidget :: Functor f => Maybe String -> f () -> Widget f a
- above :: Widget GraphicTree z -> Widget GraphicTree z -> Widget GraphicTree z
- combineAbove :: GraphicTree a -> GraphicTree a -> GraphicTree a
- beside :: Widget GraphicTree z -> Widget GraphicTree z -> Widget GraphicTree z
- combineBeside :: GraphicTree a -> GraphicTree a -> GraphicTree a
- mapGraphic :: Functor f1 => (f1 (MouseEv -> (Maybe String, Widget f z)) -> f (OutputFn f z)) -> Widget f1 z -> Widget f z
- mapWidgetFocus :: (Widget t t1 -> Widget f z) -> WidgetFocus t t1 -> WidgetFocus f z
- runOnCanvas :: (forall z. Double -> Widget GraphicTree z) -> IO ()
- data GraphicTree :: * -> * where
- Clip :: Rect -> GraphicTree a -> GraphicTree a
- Offset :: Point -> GraphicTree a -> GraphicTree a
- Branch :: Rect -> GraphicTree a -> Rect -> GraphicTree a -> GraphicTree a
- Leaf :: Graphic -> GraphicTree ()
- FMap :: (a -> b) -> GraphicTree a -> GraphicTree b
- graphicList :: [Graphic] -> GraphicTree ()
- graphicTreeBounds :: GraphicTree a -> Rect
- data MouseEv
- data MouseButton
- data Key
- balancedFold :: (a -> a -> a) -> [a] -> a
- type OutputFn f z = MouseEv -> (Maybe String, Widget f z)
- type Animate a = TimeDifference -> a
- type MouseOut a = a
- type HandleKey a = Key -> a
- type TimeDifference = Double
Widgets
Atom of a sneath lane application
data WidgetFocus f z Source
Determines the focus behavior of the widget
zipW :: (Functor f, Functor g, Functor h) => (f (OutputFn h z) -> g (OutputFn h z) -> h (OutputFn h z)) -> Widget f z -> Widget g z -> Widget h z Source
Combine two widgets to run in parallel as a single widget
Build Widgets
graphicWidget :: Functor f => Maybe String -> f () -> Widget f a Source
A widget which just shows a constant graphic output.
above :: Widget GraphicTree z -> Widget GraphicTree z -> Widget GraphicTree z Source
Combine two widgets one above the other
combineAbove :: GraphicTree a -> GraphicTree a -> GraphicTree a Source
beside :: Widget GraphicTree z -> Widget GraphicTree z -> Widget GraphicTree z Source
Combine two widgets side by side
combineBeside :: GraphicTree a -> GraphicTree a -> GraphicTree a Source
mapGraphic :: Functor f1 => (f1 (MouseEv -> (Maybe String, Widget f z)) -> f (OutputFn f z)) -> Widget f1 z -> Widget f z Source
mapWidgetFocus :: (Widget t t1 -> Widget f z) -> WidgetFocus t t1 -> WidgetFocus f z Source
Run Widgets
runOnCanvas :: (forall z. Double -> Widget GraphicTree z) -> IO () Source
Create a Canvas element filling the browser viewport, and run the given Widget there
Graphics
data GraphicTree :: * -> * where Source
A tree of graphics, used as widget output type. FMap functions are stored in the tree instead of being mapped over the leaves, so that tree reconstruction is fast when a widget changes. This is why GraphicTree is a GADT.
Offset: a sub-tree translated by a point
Branch: Two sub-trees; graphicTreeBounds are cached for each
Leaf: A leaf, consisting of a single graphic element
FMap: A graphic tree composed with a function.
Clip :: Rect -> GraphicTree a -> GraphicTree a | |
Offset :: Point -> GraphicTree a -> GraphicTree a | |
Branch :: Rect -> GraphicTree a -> Rect -> GraphicTree a -> GraphicTree a | |
Leaf :: Graphic -> GraphicTree () | |
FMap :: (a -> b) -> GraphicTree a -> GraphicTree b |
graphicList :: [Graphic] -> GraphicTree () Source
Construct a graphic tree from a nonempty list of graphics.
graphicTreeBounds :: GraphicTree a -> Rect Source
Find a rectangle containing the entire contents of the graphic tree
Events
Utility
balancedFold :: (a -> a -> a) -> [a] -> a Source
Apply a fold in a balanced fashion over a list. Recommended for combining lists of widgets, so that the widget tree has logarithmic depth.
Type synonyms
type Animate a = TimeDifference -> a Source
type TimeDifference = Double Source