summaryrefslogtreecommitdiff
path: root/Handler/Common
diff options
context:
space:
mode:
Diffstat (limited to 'Handler/Common')
-rw-r--r--Handler/Common/Types.hs23
1 files changed, 20 insertions, 3 deletions
diff --git a/Handler/Common/Types.hs b/Handler/Common/Types.hs
index ca7cb8d..08653af 100644
--- a/Handler/Common/Types.hs
+++ b/Handler/Common/Types.hs
@@ -8,15 +8,32 @@ import Control.Lens
8 8
9data InventoryState = InventoryState 9data InventoryState = InventoryState
10 { stock :: [Entity Item] 10 { stock :: [Entity Item]
11 , formState :: Maybe FormState 11 , invFormState :: Maybe (FormState ItemId)
12 } 12 }
13 13
14data FormState = InsertForm 14data ReferenceState = ReferenceState
15 { reference :: [Entity Reference]
16 , refFormState :: Maybe (FormState ReferenceId)
17 }
18
19class HasFormState a where
20 type family UpdateId a :: *
21 formState :: a -> Maybe (FormState (UpdateId a))
22
23instance HasFormState InventoryState where
24 type UpdateId InventoryState = ItemId
25 formState = invFormState
26
27instance HasFormState ReferenceState where
28 type UpdateId ReferenceState = ReferenceId
29 formState = refFormState
30
31data FormState id = InsertForm
15 { fsInsertForm :: Widget 32 { fsInsertForm :: Widget
16 , fsInsertEncoding :: Enctype 33 , fsInsertEncoding :: Enctype
17 } 34 }
18 | UpdateForm 35 | UpdateForm
19 { fsUpdateItem :: ItemId 36 { fsUpdateId :: id
20 , fsUpdateForm :: Widget 37 , fsUpdateForm :: Widget
21 , fsUpdateEncoding :: Enctype 38 , fsUpdateEncoding :: Enctype
22 } 39 }