From: Mart Lubbers Date: Mon, 5 Oct 2015 18:48:14 +0000 (+0200) Subject: :( X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=a0f3bb7efdc014031070546b962d796737cd374a;p=ap2015.git :( --- 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 )