From a0f3bb7efdc014031070546b962d796737cd374a Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 5 Oct 2015 20:48:14 +0200 Subject: [PATCH] :( --- a5/mart/a5.icl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/a5/mart/a5.icl b/a5/mart/a5.icl index 7924e16..7d9ca62 100644 --- a/a5/mart/a5.icl +++ b/a5/mart/a5.icl @@ -9,22 +9,26 @@ import iTasks 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 ) -- 2.20.1