import Text // To check string length
:: Idea = {idea :: String, details :: Maybe Note, user :: Name, number :: Int}
+:: ProtoIdea = {idea :: String, details :: Maybe Note}
:: Name:== String
-derive class iTask Idea // generic magic
+derive class iTask Idea, ProtoIdea // generic magic
ideas :: Shared [Idea]
ideas = sharedStore "Ideas" []
addNewIdea :: Task [Idea]
-addNewIdea = enterInformation "New idea" []
+addNewIdea = enterInformation "New idea" [EnterWith ideaLens]
>>* [OnAction ActionOk (hasValue (\v -> return v))]
>>= \n.upd (\is.[n:is]) ideas
+ where
+ ideaLens :: ProtoIdea -> Idea
+ ideaLens p = {idea=p.idea, user="Mart", number=42}
mainTask = forever (
addNewIdea
- -||-
- viewSharedInformation "Gathere ideas" [] ideas
+ -||
+ enterChoiceWithShared "Idea" [] ideas
)