Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors in todo example #296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/todo/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Main module for the 'Todo' example.
-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Main where
Expand Down Expand Up @@ -121,6 +122,7 @@ buildUI wenv model = widgetTree where
sectionBg = wenv ^. L.theme . L.sectionColor
isEditing
| TodoEditing _ <- model ^. action = True
| TodoAdding <- model ^. action = True
| otherwise = False

countLabel = label caption `styleBasic` styles where
Expand Down Expand Up @@ -168,7 +170,7 @@ handleEvent
-> TodoNode
-> TodoModel
-> TodoEvt
-> [EventResponse TodoModel TodoEvt TodoModel TodoEvt]
-> [AppEventResponse TodoModel TodoEvt]
handleEvent wenv node model evt = case evt of
TodoInit -> [SetFocusOnKey "todoNew"]

Expand Down Expand Up @@ -206,7 +208,7 @@ handleEvent wenv node model evt = case evt of

TodoCancelDelete -> [
Model (model & action .~ TodoNone)]

TodoDelete idx todo -> [
Model $ model & todos .~ remove idx (model ^. todos),
SetFocusOnKey "todoNew"]
Expand Down
1 change: 1 addition & 0 deletions examples/todo/TodoTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Portability : non-portable

Types for the 'Todo' example.
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}

Expand Down