on develop help sign in
Make the Functor1Constraint family sensible
cbf2fb0David Feuer
src/Reflex/Dom/Builder/Class.hs+13−7
@@ -462,14 +462,20 @@ instance (DomBuilder t m, Monoid w, MonadHold t m, MonadFix m) => DomBuilder t (
462
462
463-- * Convenience functions
463-- * Convenience functions
464
464
465+class Unconstrained g h
466+instance Unconstrained g h
467+
468+class DomBuilderSpace a ~ DomBuilderSpace b => SameDomBuilderSpace a b
469+instance DomBuilderSpace a ~ DomBuilderSpace b => SameDomBuilderSpace a b
470+
465--TODO: Move/replace
471--TODO: Move/replace
466class Functor1 (f :: (k -> *) -> *) where
472class Functor1 (f :: (k -> *) -> *) where
467− type Functor1Constraint f (a :: k -> *) (b :: k -> *) :: Constraint
473+ type Functor1Constraint f :: (k -> *) -> (k -> *) -> Constraint
468− type Functor1Constraint f a b = ()
474+ type Functor1Constraint f = Unconstrained
469 fmap1 :: Functor1Constraint f a b => (forall x. a x -> b x) -> f a -> f b
475 fmap1 :: Functor1Constraint f a b => (forall x. a x -> b x) -> f a -> f b
470
476
471instance Functor1 (ElementConfig er t) where
477instance Functor1 (ElementConfig er t) where
472− type Functor1Constraint (ElementConfig er t) a b = DomBuilderSpace a ~ DomBuilderSpace b
478+ type Functor1Constraint (ElementConfig er t) = SameDomBuilderSpace
473 {-# INLINABLE fmap1 #-}
479 {-# INLINABLE fmap1 #-}
474 fmap1 _ cfg = cfg
480 fmap1 _ cfg = cfg
475 { _elementConfig_eventSpec = _elementConfig_eventSpec cfg
481 { _elementConfig_eventSpec = _elementConfig_eventSpec cfg
@@ -482,19 +488,19 @@ instance Reflex t => Functor1 (PlaceholderConfig above t) where
482 }
488 }
483
489
484instance Functor1 (InputElementConfig er t) where
490instance Functor1 (InputElementConfig er t) where
485− type Functor1Constraint (InputElementConfig er t) a b = Functor1Constraint (ElementConfig er t) a b
491+ type Functor1Constraint (InputElementConfig er t) = Functor1Constraint (ElementConfig er t)
486 fmap1 f cfg = cfg & inputElementConfig_elementConfig %~ fmap1 f
492 fmap1 f cfg = cfg & inputElementConfig_elementConfig %~ fmap1 f
487
493
488instance Functor1 (TextAreaElementConfig er t) where
494instance Functor1 (TextAreaElementConfig er t) where
489− type Functor1Constraint (TextAreaElementConfig er t) a b = Functor1Constraint (ElementConfig er t) a b
495+ type Functor1Constraint (TextAreaElementConfig er t) = Functor1Constraint (ElementConfig er t)
490 fmap1 f cfg = cfg & textAreaElementConfig_elementConfig %~ fmap1 f
496 fmap1 f cfg = cfg & textAreaElementConfig_elementConfig %~ fmap1 f
491
497
492instance Functor1 (SelectElementConfig er t) where
498instance Functor1 (SelectElementConfig er t) where
493− type Functor1Constraint (SelectElementConfig er t) a b = Functor1Constraint (ElementConfig er t) a b
499+ type Functor1Constraint (SelectElementConfig er t) = Functor1Constraint (ElementConfig er t)
494 fmap1 f cfg = cfg & selectElementConfig_elementConfig %~ fmap1 f
500 fmap1 f cfg = cfg & selectElementConfig_elementConfig %~ fmap1 f
495
501
496instance Functor1 (RawElementConfig er t) where
502instance Functor1 (RawElementConfig er t) where
497− type Functor1Constraint (RawElementConfig er t) a b = DomBuilderSpace a ~ DomBuilderSpace b
503+ type Functor1Constraint (RawElementConfig er t) = SameDomBuilderSpace
498 {-# INLINABLE fmap1 #-}
504 {-# INLINABLE fmap1 #-}
499 fmap1 _ cfg = cfg
505 fmap1 _ cfg = cfg
500 { _rawElementConfig_eventSpec = _rawElementConfig_eventSpec cfg
506 { _rawElementConfig_eventSpec = _rawElementConfig_eventSpec cfg