on develop help sign in
Update QuickRef (#84)

* Replace String with Text. * Add 'a' param to XhrRequest and XhrRequestConfig.

commitddce6f4916b15b45995e381100ea7bf0a4490e6c authorMartijn Rijkeboer <martijn@bunix.org> dateTue 23 Aug 2016, 02:04 (10 years ago) parentad56caf
1 file changed+19−22
Quickref.md+19−22
Quickref.md+19−22
@@ -23,41 +23,38 @@ Widgets may return any type (this is 'a' in many of the functions below). Often
2323```haskell
2424-- Simplest form. Create a widget of given type containing the given child.
2525-- Return whatever the child returns.
26−[W] el :: String -> m a -> m a
26+[W] el :: Text -> m a -> m a
2727
2828-- This version returns the 'El' as well.
29−[W] el' :: String -> m a -> m (El, a)
29+[W] el' :: Text -> m a -> m (El, a)
3030
3131-- These two additionally apply attributes to the element, such as ("class" =: "blah")
32−[W] elAttr :: String -> Map String String -> m a -> m a
33−[W] elAttr' :: String -> Map String String -> m a -> m (El, a)
32+[W] elAttr :: Text -> Map Text Text -> m a -> m a
33+[W] elAttr' :: Text -> Map Text Text -> m a -> m (El, a)
3434
3535-- As above, but now the attribute map is Dynamic
36−[W] elDynAttr :: String -> Dynamic (Map String String) -> m a -> m a
37−[W] elDynAttr' :: String -> Dynamic (Map String String) -> m a -> m (El, a)
36+[W] elDynAttr :: Text -> Dynamic (Map Text Text) -> m a -> m a
37+[W] elDynAttr' :: Text -> Dynamic (Map Text Text) -> m a -> m (El, a)
3838
3939-- Shortcut for elAttr when you only want to set the "class" attribute.
40−[W] elClass :: String -> String -> m a -> m a
40+[W] elClass :: Text -> Text -> m a -> m a
4141
4242-- Even shorter-cut for above when element type is "div". Create a div of given class.
43−[W] divClass :: String -> m a -> m a
43+[W] divClass :: Text -> m a -> m a
4444
4545-- Create a widget of given type with arbitrary, Dymamic HTML inside.
46−[W] elDynHtml' :: String -> Dynamic String -> m El
47−[W] elDynHtmlAttr' :: String -> Map String String -> Dynamic String -> m El
48−
49−-- Shortcut for elDynHtml' where the type is "div" and you don't need the 'El'.
50−[W] dynHtml :: Dynamic String -> m ()
46+[W] elDynHtml' :: Text -> Dynamic Text -> m El
47+[W] elDynHtmlAttr' :: Text -> Map Text Text -> Dynamic Text -> m El
5148
5249-- Create a static text element
53−[W] text :: String -> m ()
50+[W] text :: Text -> m ()
5451
5552-- Create a dynamic text element
56−[W] dynText :: Dynamic String -> m ()
53+[W] dynText :: Dynamic Text -> m ()
5754[W] display :: Show a => Dynamic a -> m ()
5855
5956-- Create a "button" element with given label, return onClick Event
60−[W] button :: String -> m (Event ())
57+[W] button :: Text -> m (Event ())
6158
6259-- Empty widget
6360[W] blank :: m ()
@@ -121,13 +118,13 @@ Some of these widget builders take a configuration record and return a record co
121118
122119-- Dropdown with Dynamic options. First argument is initial state.
123120[W] dropdown :: (Ord k, Show k, Read k) =>
124− k -> Dynamic (Map k String) -> DropdownConfig k -> m (Dropdown k)
121+ k -> Dynamic (Map k Text) -> DropdownConfig k -> m (Dropdown k)
125122
126123-- Table with static columns and dynamic rows.
127124[W] tableDynAttr :: ... -- See Reflex.Dom.Widget.Basic
128125
129126-- Tabbed view that shows only one of its child widgets at a time.
130−[W] tabDisplay :: (Show k, Ord k) => String -> String -> Map k (String, m ()) -> m ()
127+[W] tabDisplay :: (Show k, Ord k) => Text -> Text -> Map k (Text, m ()) -> m ()
131128
132129-- Widget to efficiently display long scrolling lists.
133130[W] virtualListWithSelection :: ... -- See Reflex.Dom.Widget.Lazy
@@ -163,19 +160,19 @@ Convenience functions for XMLHttpRequest. see Reflex.Dom.Xhr
163160
164161```haskell
165162-- Given method, URL, and config record (with default instance), construct a request.
166−[ ] xhrRequest :: String -> String -> XhrRequestConfig -> XhrRequest
163+[ ] xhrRequest :: Text -> Text -> XhrRequestConfig a -> XhrRequest a
167164
168165-- Given Event of requests, issue them and produce Event of responses.
169−[W] performRequestAsync :: Event XhrRequest -> m (Event XhrResponse)
166+[W] performRequestAsync :: Event (XhrRequest a) -> m (Event XhrResponse)
170167
171168-- Issue a collection of requests, wait for them ALL to complete, return collected results.
172−[W] performRequestsAsync :: Traversable f => Event (f XhrRequest) -> m (Event (f XhrResponse))
169+[W] performRequestsAsync :: Traversable f => Event (f (XhrRequest a)) -> m (Event (f XhrResponse))
173170
174171-- Convenience function to decode JSON-encoded responses.
175172[ ] decodeXhrResponse :: FromJSON a => XhrResponse -> Maybe a
176173
177174-- Simplified interface to "GET" URLs and return decoded results.
178−[W] getAndDecode :: FromJSON a => Event String -> m (Event (Maybe a))
175+[W] getAndDecode :: FromJSON a => Event Text -> m (Event (Maybe a))
179176```
180177
181178### Time