Advertisement
Guest User

Untitled

a guest
May 18th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bodyElement :: MonadWidget t m => m ()
  2. bodyElement = el "div" $ do
  3.   el "h2" $ text "Dropdown"
  4.   text "Select country "
  5.   dd <- dropdown 2 (constDyn countries) def
  6.   el "p" $ return ()
  7.   let selItem = result <$> value dd
  8.   dynText selItem
  9.  
  10. countries :: Map.Map Int T.Text
  11. countries = Map.fromList [(1, "France"), (2, "Switzerland"), (3, "Germany"), (4, "Italy"), (5, "USA")]
  12.  
  13. result :: Int -> T.Text
  14. result key = "You selected: " <> fromJust (Map.lookup key countries)
  15.  
  16.  
  17. The data model:
  18.  
  19. data Event :: Type -> Type where
  20.     Event_PracticeTypeSolo :: Event SoloPersonPracticeType
  21.  
  22. data SoloPersonPracticeType =
  23.         Solo_Workout -- Jumprope, pushups, weightlifting etc.
  24.     |   Solo_Run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement