Haskell wrapper for iced gui library. Very experimental, check Roadmap to see progress.
Desktop - Windows, macOS, Linux. Supported targets are the same as for iced except the web target, since it's tricky to link wasm produced by different compilers. With some effort it may be possible, just not out of the box.
Check examples for more
import Iced
import Iced.Attribute
import Iced.Attribute.Alignment
import Iced.Theme
import Iced.Widget
data Message = Inc | Dec
update :: Message -> Int -> Int
update Inc = succ
update Dec = pred
view :: Int -> Element
view value =
container [centerX Fill, centerY Fill] $
column [alignX Center, spacing 10] [
button [onPress Inc] "Increment",
text [size 50] $ show value,
button [onPress Dec] "Decrement"
]
main :: IO ()
main = Iced.run [theme GruvboxLight] "Counter" 0 update view
From themes example:
First, build rust crate to produce libiced_hs.a
./build_rust.sh
then pass it to ghc
ghc -ipath/to/this/repo path/to/libiced_hs.a main.hs
- wgpu - graphics
- winit - windowing
- tokio - runtime
- cosmic-text - multi-line text handling
Below is a list of inspiring projects
This is a research project. The api may change often. Not recommended for use in production. It still may be a good option if you need a simple way to build some ui.
- Widgets
- button
- checkbox
- column
- comboBox
- container
- image
- keyedColumn
- mouseArea
- paneGrid
- progressBar
- pickList
- qrCode
- radio
- responsive
- horizontalRule, verticalRule
- row
- scrollable
- slider, verticalSlider
- horizontalSpace, verticalSpace
- svg
- text
- textEditor
- textInput
- toggler
- tooltip
- Helper functions
- lazy
- themer
- focusNext, focusPrevious
- Themes
- Canvas api
- canvas widget
- fill path
- stroke path
- path methods - circle, lineTo, moveTo, rectangle
- more path methods
- Shader
- shader widget
- attributes
- Multi window
- Custom widgets
- Subscriptions
- subscription attribute for Application
- Time.every subscription
- Keyboard
- onKeyPress
- onKeyRelease
- PhysicalKey
- KeyCode
- NativeKeyCode
- LogicalKey
- Named
- Character
- custom subscriptions
- other events
- Command api
-
Command.perform
for RustFuture
-
Command.performBlocking
for blocking tasks
-
- Add all attributes from iced for each widget
- Styles for widgets
- button
- checkobx
- container
- pickList
- progressBar
- radio
- text
- textInput
- textEditor
- ...