Skip to content

ibaryshnikov/iced-hs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iced-hs

Haskell wrapper for iced gui library. Very experimental, check Roadmap to see progress.

Platform support

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.

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

Preview

From themes example:

Themes preview

Usage

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

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
    • 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 Rust Future
    • 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
    • ...

Releases

No releases published

Packages

No packages published