Initial (partial) commit

This commit is contained in:
Francisco Vallarino 2021-02-04 09:57:15 -03:00
parent 177cebfd25
commit 3fb8fa4a4b
3 changed files with 62 additions and 12 deletions

2
.ghcid
View File

@ -1,3 +1,3 @@
--command "stack repl"
--command "stack repl monomer:exe:todo"
--test ":main"
--restart=package.yaml

43
examples/todo/Main.hs Normal file
View File

@ -0,0 +1,43 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Codec.Serialise
import Data.Default
import Data.Text (Text)
import GHC.Generics
import Monomer
data TodoModel = TodoModel {
_active :: [Todo],
_complete :: [Todo]
} deriving (Eq, Show, Generic, Serialise)
data Todo = Todo {
_todoDesc :: Text,
_todoComplete :: Bool
} deriving (Eq, Show, Generic, Serialise)
data TodoEvt
= TodoInit
deriving (Eq, Show)
buildUI wenv model = widgetTree where
widgetTree = vstack [
label "Test"
]
handleEvent wenv node model evt = case evt of
TodoInit -> []
main = do
simpleApp_ model handleEvent buildUI config
where
model = TodoModel [] []
config = [
appTheme darkTheme,
appFontDef "Regular" "./assets/fonts/Roboto-Regular.ttf"
]

View File

@ -1,18 +1,18 @@
name: monomer
version: 0.1.0.0
github: "fjvallarino/monomer"
license: BSD3
author: "Francisco Vallarino"
maintainer: "fjvallarino@gmail.com"
copyright: "2018 Francisco Vallarino"
name: monomer
version: 0.1.0.0
github: "fjvallarino/monomer"
license: BSD3
author: "Francisco Vallarino"
maintainer: "fjvallarino@gmail.com"
copyright: "2018 Francisco Vallarino"
extra-source-files:
- README.md
- ChangeLog.md
# Metadata used when publishing your package
# synopsis: GUI Library
# category: GUI
synopsis: GUI Library
category: GUI
# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
@ -64,8 +64,8 @@ library:
executables:
monomer-exe:
main: Main.hs
source-dirs: app
main: Main.hs
source-dirs: app
ghc-options:
- -fwarn-incomplete-patterns
- -threaded
@ -78,6 +78,13 @@ executables:
- lens
- monomer
todo:
main: Main.hs
source-dirs: examples/todo
dependencies:
- lens
- monomer
tests:
monomer-test:
main: Spec.hs