@@ -1,3 +1,4 @@
1{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DefaultSignatures #-}
4{-# LANGUAGE DefaultSignatures #-}
@@ -12,6 +13,9 @@
12{-# LANGUAGE RankNTypes #-}
13{-# LANGUAGE RankNTypes #-}
13{-# LANGUAGE RecursiveDo #-}
14{-# LANGUAGE RecursiveDo #-}
14{-# LANGUAGE ScopedTypeVariables #-}
15{-# LANGUAGE ScopedTypeVariables #-}
16+#ifdef USE_TEMPLATE_HASKELL
17+{-# LANGUAGE TemplateHaskell #-}
15{-# LANGUAGE TypeFamilies #-}
19{-# LANGUAGE TypeFamilies #-}
16{-# LANGUAGE UndecidableInstances #-}
20{-# LANGUAGE UndecidableInstances #-}
17module Reflex.Dom.Builder.Class
21module Reflex.Dom.Builder.Class
@@ -150,6 +154,7 @@ data TextNodeConfig t
150 , _textNodeConfig_setContents :: Event t Text
154 , _textNodeConfig_setContents :: Event t Text
157+#ifndef USE_TEMPLATE_HASKELL
153textNodeConfig_initialContents :: Lens' (TextNodeConfig t) Text
158textNodeConfig_initialContents :: Lens' (TextNodeConfig t) Text
154textNodeConfig_initialContents f (TextNodeConfig a b) = (\a' -> TextNodeConfig a' b) <$> f a
159textNodeConfig_initialContents f (TextNodeConfig a b) = (\a' -> TextNodeConfig a' b) <$> f a
155{-# INLINE textNodeConfig_initialContents #-}
160{-# INLINE textNodeConfig_initialContents #-}
@@ -160,6 +165,7 @@ textNodeConfig_setContents :: Lens
160 (Event t2 Text)
165 (Event t2 Text)
161textNodeConfig_setContents f (TextNodeConfig a b) = (\b' -> TextNodeConfig a b') <$> f b
166textNodeConfig_setContents f (TextNodeConfig a b) = (\b' -> TextNodeConfig a b') <$> f b
162{-# INLINE textNodeConfig_setContents #-}
167{-# INLINE textNodeConfig_setContents #-}
164instance (Reflex t) => Default (TextNodeConfig t) where
170instance (Reflex t) => Default (TextNodeConfig t) where
165 {-# INLINABLE def #-}
171 {-# INLINABLE def #-}
@@ -225,6 +231,7 @@ data ElementConfig er t m
225 , _elementConfig_eventSpec :: EventSpec (DomBuilderSpace m) er
231 , _elementConfig_eventSpec :: EventSpec (DomBuilderSpace m) er
234+#ifndef USE_TEMPLATE_HASKELL
228elementConfig_namespace :: Lens' (ElementConfig er t m) (Maybe Namespace)
235elementConfig_namespace :: Lens' (ElementConfig er t m) (Maybe Namespace)
229elementConfig_namespace f (ElementConfig a b c d) = (\a' -> ElementConfig a' b c d) <$> f a
236elementConfig_namespace f (ElementConfig a b c d) = (\a' -> ElementConfig a' b c d) <$> f a
230{-# INLINE elementConfig_namespace #-}
237{-# INLINE elementConfig_namespace #-}
@@ -245,6 +252,7 @@ elementConfig_eventSpec :: Lens
245 (EventSpec (DomBuilderSpace m2) er2)
252 (EventSpec (DomBuilderSpace m2) er2)
246elementConfig_eventSpec f (ElementConfig a b c d) = (\d' -> ElementConfig a b c d') <$> f d
253elementConfig_eventSpec f (ElementConfig a b c d) = (\d' -> ElementConfig a b c d') <$> f d
247{-# INLINE elementConfig_eventSpec #-}
254{-# INLINE elementConfig_eventSpec #-}
249data Element er d t
257data Element er d t
250 = Element { _element_events :: EventSelector t (WrapArg er EventName) --TODO: EventSelector should have two arguments
258 = Element { _element_events :: EventSelector t (WrapArg er EventName) --TODO: EventSelector should have two arguments
@@ -256,6 +264,7 @@ data PlaceholderConfig above t m
256 , _placeholderConfig_deleteSelf :: Event t ()
264 , _placeholderConfig_deleteSelf :: Event t ()
267+#ifndef USE_TEMPLATE_HASKELL
259placeholderConfig_insertAbove :: Lens
268placeholderConfig_insertAbove :: Lens
260 (PlaceholderConfig above1 t m1)
269 (PlaceholderConfig above1 t m1)
261 (PlaceholderConfig above2 t m2)
270 (PlaceholderConfig above2 t m2)
@@ -266,6 +275,7 @@ placeholderConfig_insertAbove f (PlaceholderConfig a b) = (\a' -> PlaceholderCon
266placeholderConfig_deleteSelf :: Lens' (PlaceholderConfig above t m) (Event t ())
275placeholderConfig_deleteSelf :: Lens' (PlaceholderConfig above t m) (Event t ())
267placeholderConfig_deleteSelf f (PlaceholderConfig a b) = (\b' -> PlaceholderConfig a b') <$> f b
276placeholderConfig_deleteSelf f (PlaceholderConfig a b) = (\b' -> PlaceholderConfig a b') <$> f b
268{-# INLINE placeholderConfig_deleteSelf #-}
277{-# INLINE placeholderConfig_deleteSelf #-}
270instance Reflex t => Default (PlaceholderConfig above t m) where
280instance Reflex t => Default (PlaceholderConfig above t m) where
271 {-# INLINABLE def #-}
281 {-# INLINABLE def #-}
@@ -287,6 +297,7 @@ data InputElementConfig er t m
287 , _inputElementConfig_elementConfig :: ElementConfig er t m
297 , _inputElementConfig_elementConfig :: ElementConfig er t m
300+#ifndef USE_TEMPLATE_HASKELL
290inputElementConfig_initialValue :: Lens' (InputElementConfig er t m) Text
301inputElementConfig_initialValue :: Lens' (InputElementConfig er t m) Text
291inputElementConfig_initialValue f (InputElementConfig a b c d e) = (\a' -> InputElementConfig a' b c d e) <$> f a
302inputElementConfig_initialValue f (InputElementConfig a b c d e) = (\a' -> InputElementConfig a' b c d e) <$> f a
292{-# INLINE inputElementConfig_initialValue #-}
303{-# INLINE inputElementConfig_initialValue #-}
@@ -306,6 +317,7 @@ inputElementConfig_elementConfig :: Lens
306 (ElementConfig er2 t m2)
317 (ElementConfig er2 t m2)
307inputElementConfig_elementConfig f (InputElementConfig a b c d e) = (\e' -> InputElementConfig a b c d e') <$> f e
318inputElementConfig_elementConfig f (InputElementConfig a b c d e) = (\e' -> InputElementConfig a b c d e') <$> f e
308{-# INLINE inputElementConfig_elementConfig #-}
319{-# INLINE inputElementConfig_elementConfig #-}
310instance (Reflex t, er ~ EventResult, DomBuilder t m) => Default (InputElementConfig er t m) where
322instance (Reflex t, er ~ EventResult, DomBuilder t m) => Default (InputElementConfig er t m) where
311 {-# INLINABLE def #-}
323 {-# INLINABLE def #-}
@@ -334,6 +346,7 @@ data TextAreaElementConfig er t m
334 , _textAreaElementConfig_elementConfig :: ElementConfig er t m
346 , _textAreaElementConfig_elementConfig :: ElementConfig er t m
349+#ifndef USE_TEMPLATE_HASKELL
337textAreaElementConfig_initialValue :: Lens' (TextAreaElementConfig er t m) Text
350textAreaElementConfig_initialValue :: Lens' (TextAreaElementConfig er t m) Text
338textAreaElementConfig_initialValue f (TextAreaElementConfig a b c) = (\a' -> TextAreaElementConfig a' b c) <$> f a
351textAreaElementConfig_initialValue f (TextAreaElementConfig a b c) = (\a' -> TextAreaElementConfig a' b c) <$> f a
339{-# INLINE textAreaElementConfig_initialValue #-}
352{-# INLINE textAreaElementConfig_initialValue #-}
@@ -347,6 +360,7 @@ textAreaElementConfig_elementConfig :: Lens
347 (ElementConfig er2 t m2)
360 (ElementConfig er2 t m2)
348textAreaElementConfig_elementConfig f (TextAreaElementConfig a b c) = (\c' -> TextAreaElementConfig a b c') <$> f c
361textAreaElementConfig_elementConfig f (TextAreaElementConfig a b c) = (\c' -> TextAreaElementConfig a b c') <$> f c
349{-# INLINE textAreaElementConfig_elementConfig #-}
362{-# INLINE textAreaElementConfig_elementConfig #-}
351instance (Reflex t, er ~ EventResult, DomBuilder t m) => Default (TextAreaElementConfig er t m) where
365instance (Reflex t, er ~ EventResult, DomBuilder t m) => Default (TextAreaElementConfig er t m) where
352 {-# INLINABLE def #-}
366 {-# INLINABLE def #-}
@@ -375,6 +389,7 @@ data RawElementConfig er t m = RawElementConfig
375 , _rawElementConfig_eventSpec :: EventSpec (DomBuilderSpace m) er
389 , _rawElementConfig_eventSpec :: EventSpec (DomBuilderSpace m) er
392+#ifndef USE_TEMPLATE_HASKELL
378rawElementConfig_modifyAttributes :: Lens
393rawElementConfig_modifyAttributes :: Lens
379 (RawElementConfig er t1 m)
394 (RawElementConfig er t1 m)
380 (RawElementConfig er t2 m)
395 (RawElementConfig er t2 m)
@@ -389,6 +404,7 @@ rawElementConfig_eventSpec :: Lens
389 (EventSpec (DomBuilderSpace m2) er2)
404 (EventSpec (DomBuilderSpace m2) er2)
390rawElementConfig_eventSpec f (RawElementConfig a b) = (\b' -> RawElementConfig a b') <$> f b
405rawElementConfig_eventSpec f (RawElementConfig a b) = (\b' -> RawElementConfig a b') <$> f b
391{-# INLINE rawElementConfig_eventSpec #-}
406{-# INLINE rawElementConfig_eventSpec #-}
393instance (Reflex t, DomSpace (DomBuilderSpace m)) => Default (RawElementConfig EventResult t m) where
409instance (Reflex t, DomSpace (DomBuilderSpace m)) => Default (RawElementConfig EventResult t m) where
394 def = RawElementConfig
410 def = RawElementConfig
@@ -402,6 +418,7 @@ data SelectElementConfig er t m = SelectElementConfig
402 , _selectElementConfig_elementConfig :: ElementConfig er t m
418 , _selectElementConfig_elementConfig :: ElementConfig er t m
421+#ifndef USE_TEMPLATE_HASKELL
405selectElementConfig_initialValue :: Lens' (SelectElementConfig er t m) Text
422selectElementConfig_initialValue :: Lens' (SelectElementConfig er t m) Text
406selectElementConfig_initialValue f (SelectElementConfig a b c) = (\a' -> SelectElementConfig a' b c) <$> f a
423selectElementConfig_initialValue f (SelectElementConfig a b c) = (\a' -> SelectElementConfig a' b c) <$> f a
407{-# INLINE selectElementConfig_initialValue #-}
424{-# INLINE selectElementConfig_initialValue #-}
@@ -415,6 +432,7 @@ selectElementConfig_elementConfig :: Lens
415 (ElementConfig er2 t m2)
432 (ElementConfig er2 t m2)
416selectElementConfig_elementConfig f (SelectElementConfig a b c) = (\c' -> SelectElementConfig a b c') <$> f c
433selectElementConfig_elementConfig f (SelectElementConfig a b c) = (\c' -> SelectElementConfig a b c') <$> f c
417{-# INLINE selectElementConfig_elementConfig #-}
434{-# INLINE selectElementConfig_elementConfig #-}
419instance (Reflex t, er ~ EventResult, DomBuilder t m) => Default (SelectElementConfig er t m) where
437instance (Reflex t, er ~ EventResult, DomBuilder t m) => Default (SelectElementConfig er t m) where
420 def = SelectElementConfig
438 def = SelectElementConfig
@@ -431,6 +449,18 @@ data SelectElement er d t = SelectElement
431 , _selectElement_raw :: RawSelectElement d
449 , _selectElement_raw :: RawSelectElement d
452+#ifdef USE_TEMPLATE_HASKELL
453+concat <$> mapM makeLenses
456+ , ''PlaceholderConfig
457+ , ''InputElementConfig
458+ , ''TextAreaElementConfig
459+ , ''SelectElementConfig
460+ , ''RawElementConfig
434class CanDeleteSelf t a | a -> t where
464class CanDeleteSelf t a | a -> t where
435 deleteSelf :: Lens' a (Event t ())
465 deleteSelf :: Lens' a (Event t ())