diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-03-14 18:33:42 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-03-14 18:33:42 +0100 |
commit | 7bc954b779a9bc4e1c5e60f2648101c62ed22e72 (patch) | |
tree | b30851324772c14550c0444b7e79e36256f67900 /Handler/Common | |
parent | 53fcf55c02f9335518c28d26429913258fc28f87 (diff) | |
download | bar-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.hs | 23 |
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 | ||
9 | data InventoryState = InventoryState | 9 | data InventoryState = InventoryState |
10 | { stock :: [Entity Item] | 10 | { stock :: [Entity Item] |
11 | , formState :: Maybe FormState | 11 | , invFormState :: Maybe (FormState ItemId) |
12 | } | 12 | } |
13 | 13 | ||
14 | data FormState = InsertForm | 14 | data ReferenceState = ReferenceState |
15 | { reference :: [Entity Reference] | ||
16 | , refFormState :: Maybe (FormState ReferenceId) | ||
17 | } | ||
18 | |||
19 | class HasFormState a where | ||
20 | type family UpdateId a :: * | ||
21 | formState :: a -> Maybe (FormState (UpdateId a)) | ||
22 | |||
23 | instance HasFormState InventoryState where | ||
24 | type UpdateId InventoryState = ItemId | ||
25 | formState = invFormState | ||
26 | |||
27 | instance HasFormState ReferenceState where | ||
28 | type UpdateId ReferenceState = ReferenceId | ||
29 | formState = refFormState | ||
30 | |||
31 | data 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 | } |