File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 11module Halogen.VDom.Types
22 ( VDom (..)
3+ , renderWidget
34 , Graft
45 , GraftX (..)
56 , graft
@@ -39,6 +40,15 @@ instance bifunctorVDom ∷ Bifunctor VDom where
3940 bimap f g (Grafted a) = Grafted (bimap f g a)
4041 bimap f g a = Grafted (graft (Graft f g a))
4142
43+ renderWidget ∷ ∀ a w x . (w → VDom a x ) → VDom a w → VDom a x
44+ renderWidget f = case _ of
45+ Text a → Text a
46+ Elem ns n a ch → Elem ns n a (map (renderWidget f) ch)
47+ Keyed ns n a ch → Keyed ns n a (map (map (renderWidget f)) ch)
48+ Widget w → f w
49+ Grafted g → Grafted $ unGraft (\(Graft fa fw v) →
50+ graft (Graft identity identity (renderWidget f (bimap fa fw v)))) g
51+
4252foreign import data Graft ∷ Type → Type → Type
4353
4454instance functorGraft ∷ Functor (Graft a ) where
You can’t perform that action at this time.
0 commit comments