summaryrefslogtreecommitdiff
path: root/Handler/Common
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2017-03-14 18:33:42 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2017-03-14 18:33:42 +0100
commit7bc954b779a9bc4e1c5e60f2648101c62ed22e72 (patch)
treeb30851324772c14550c0444b7e79e36256f67900 /Handler/Common
parent53fcf55c02f9335518c28d26429913258fc28f87 (diff)
downloadbar-7bc954b779a9bc4e1c5e60f2648101c62ed22e72.tar
bar-7bc954b779a9bc4e1c5e60f2648101c62ed22e72.tar.gz
bar-7bc954b779a9bc4e1c5e60f2648101c62ed22e72.tar.bz2
bar-7bc954b779a9bc4e1c5e60f2648101c62ed22e72.tar.xz
bar-7bc954b779a9bc4e1c5e60f2648101c62ed22e72.zip
Reference & list
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 }