Haskell wrapper for iced gui library. Very experimental, check Roadmap to see progress.
To learn more about iced check official website and the book
The api is inspired by Elm and elm-ui. Canvas is inspired by elm-canvas
Note: temporarily switched to a fork to provide access to KeyCode from winit. Currently iced provides only logical key, check this pr for more details. Eventually physical key will be added back to iced. When that happens, the iced dependency will be changed back to the original crate. Also, was using latest upstream to get unreleased styles api. Will use the version from crates.io when all the necessary changes are published.
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.Widget
data Message = Inc | Dec
update :: Int -> Message -> Int
update value Inc = value + 1
update value Dec = value - 1
view :: Int -> Element
view value = column [] [
button [onPress Inc] "Inc",
text [] $ show value,
button [onPress Dec] "Dec"
]
main :: IO ()
main = Iced.run [] "Counter" 0 update view
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
- graphics - wgpu
- windowing - winit
- runtime - tokio, though other runtimes are available through features in original iced crate
This is a research project. The api may change often. Not recommended for use in production. But may be a good option if you are learning Haskell or need a simple way to build a ui or display some data.
- 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
- 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
- multiple signatures for
update
function:Model -> Message -> Model Model -> Message -> IO Model Model -> Message -> (Model, Command Message) Model -> Message -> IO (Model, Command Message)
-
Command.Perform
for RustFuture
-
Command.PerformIO
for blocking tasks
- multiple signatures for
- Add all attributes from iced for each widget
- theme attribute for Application
- Styles for widgets
- button
- ...