Skip to content

ibaryshnikov/iced-hs

Repository files navigation

iced-hs

Haskell wrapper for iced gui library. Very experimental, check Roadmap to see progress. There is some documentation available.

Platform support

Desktops - tested on Linux, and macOS should work too. Build for Windows currently doesn't work, see related issue for more details.

Example

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

Counter preview

Themes example

Themes preview

Beautiful Ferra theme was built by Halloy team. Check the complete example.

Required build tools

Rust toolchain is 1.84 or above. Haskell build uses cabal and supported versions are specified in iced-hs.cabal file. It's also possible to build with GHC alone. Use provided bash scripts as an example.

Usage

Run the examples with cabal:

cabal run counter

Or use bash scripts:

# build `libiced_hs.a`
./build_rust.sh
# then pass it to ghc
ghc -ipath/to/this/repo path/to/libiced_hs.a main.hs

Internals

Credits

Below is a list of inspiring projects

Status

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.

Roadmap

  • Widgets
    • button
    • canvas
    • checkbox
    • column
    • comboBox
    • container
    • image
    • keyedColumn
    • markdown
    • 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
    • Frame methods
      • drawImage
      • drawSvg
      • fill
      • fillText
      • pushTransform
      • popTransform
      • rotate
      • scale
      • stroke
      • more frame methods
    • 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
  • Task api
    • Task.perform for Rust Future
    • Task.performBlocking for blocking tasks
  • Add all attributes from iced for each widget
  • Styles for widgets
    • button
    • checkbox
    • container
    • pickList
    • progressBar
    • radio
    • text
    • textInput
    • textEditor
    • ...

About

Haskell wrapper for iced

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages