Commit fc558d33 authored by Steffen Michels's avatar Steffen Michels

made basic examples compile with recent editor API changes & fixed some imports

parent 1cac8f21
......@@ -204,11 +204,11 @@ viewStoredPersons = viewSharedInformation "These are the currently stored person
notes :: Task String
notes
= withShared ""
(\note -> viewSharedInformation "view on note" [ViewUsing id (textView 'DM'.newMap)] note
(\note -> viewSharedInformation "view on note" [ViewUsing id textView] note
-||-
updateSharedInformation "edit shared note 1" [UpdateUsing id (const id) (textArea 'DM'.newMap)] note
updateSharedInformation "edit shared note 1" [UpdateUsing id (const id) textArea] note
-||-
updateSharedInformation "edit shared note 2" [UpdateUsing id (const id) (textArea 'DM'.newMap)] note
updateSharedInformation "edit shared note 2" [UpdateUsing id (const id) textArea] note
)
linesPar :: Task (Maybe String)
......@@ -229,7 +229,7 @@ where
lineE state
= updateSharedInformation ("Lines","Edit lines") [listEditor] state
noteEditor = UpdateUsing id (const id) (textArea 'DM'.newMap)
noteEditor = UpdateUsing id (const id) textArea
listEditor = UpdateAs (split "\n") (\_ l -> join "\n" l)
browseAndViewGoogleMap :: Task GoogleMap
......@@ -486,7 +486,7 @@ editWithStatistics
editFile :: String (Shared String) (SharedTaskList ()) -> Task ()
editFile fileName sharedFile _
= updateSharedInformation ("edit " +++ fileName) [UpdateUsing id (const id) (textArea 'DM'.newMap)] sharedFile
= updateSharedInformation ("edit " +++ fileName) [UpdateUsing id (const id) textArea] sharedFile
@! ()
showStatistics sharedFile _ = noStat <<@ InWindow
......
......@@ -8,9 +8,9 @@ import qualified Data.Map as DM
gText{|EUR|} _ val = [maybe "" toString val]
gEditor{|EUR|} = selectByMode
(comapEditorValue toString (textView 'DM'.newMap))
(bijectEditorValue (\(EUR v) -> toReal v / 100.0) (\v -> EUR (toInt (100.0 * v))) (withDynamicHintAttributes "amount in EUR" (decimalField 'DM'.newMap)))
(bijectEditorValue (\(EUR v) -> toReal v / 100.0) (\v -> EUR (toInt (100.0 * v))) (withDynamicHintAttributes "amount in EUR" (decimalField 'DM'.newMap)))
(comapEditorValue toString textView)
(bijectEditorValue (\(EUR v) -> toReal v / 100.0) (\v -> EUR (toInt (100.0 * v))) (withDynamicHintAttributes "amount in EUR" decimalField))
(bijectEditorValue (\(EUR v) -> toReal v / 100.0) (\v -> EUR (toInt (100.0 * v))) (withDynamicHintAttributes "amount in EUR" decimalField))
instance toString EUR
where
......@@ -43,9 +43,9 @@ where
gText{|USD|} _ val = [maybe "" toString val]
gEditor{|USD|} = selectByMode
(comapEditorValue toString (textView 'DM'.newMap))
(bijectEditorValue (\(USD v) -> toReal v / 100.0) (\v -> USD (toInt (100.0 * v))) (withDynamicHintAttributes "amount in USD" (decimalField 'DM'.newMap)))
(bijectEditorValue (\(USD v) -> toReal v / 100.0) (\v -> USD (toInt (100.0 * v))) (withDynamicHintAttributes "amount in USD" (decimalField 'DM'.newMap)))
(comapEditorValue toString textView)
(bijectEditorValue (\(USD v) -> toReal v / 100.0) (\v -> USD (toInt (100.0 * v))) (withDynamicHintAttributes "amount in USD" decimalField))
(bijectEditorValue (\(USD v) -> toReal v / 100.0) (\v -> USD (toInt (100.0 * v))) (withDynamicHintAttributes "amount in USD" decimalField))
instance toString USD
where
......
......@@ -22,6 +22,7 @@ import qualified Data.Queue as DQ
import Data.Maybe, Data.Either, Data.Error
import Text.JSON
from Data.Functor import <$>
derive gEq ParallelTaskChange
......@@ -526,7 +527,7 @@ evalParallelTasks listId taskTrees event evalOpts conts completed [{ParallelTask
//Decode value value
# mbValue = case encValue of
NoValue = Just NoValue
Value json stable = fmap (\dec -> Value dec stable) (fromJSON json)
Value json stable = (\dec -> Value dec stable) <$> fromJSON json
//TODO: use global tasktime to be able to compare event times between instances
# evalInfo = {TaskEvalInfo|lastEvent=0,removedTasks=[],refreshSensitive=True}
= maybe (ExceptionResult (exception "Could not decode task value of detached task"))
......
......@@ -4,14 +4,14 @@ import iTasks.WF.Definition
import iTasks.WF.Tasks.Core
import iTasks.WF.Combinators.Core
import iTasks.WF.Combinators.Common
import Data.Maybe, Data.Either, Data.List
import Data.Maybe, Data.Either, Data.List, Data.Functor
import iTasks.Internal.Serialization
instance Functor Task where
fmap f x = transform (fmap f) x
instance TApplicative Task where
(<#>) tf ta = tf >>= \f -> fmap f ta
(<#>) tf ta = tf >>= \f -> f <$> ta
return x = treturn x
instance TMonad Task where
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment