Skip to content

Commit

Permalink
Fix warning: star-is-type
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfmpe committed Jan 12, 2025
1 parent 7addc57 commit 2dd4b41
Showing 7 changed files with 30 additions and 23 deletions.
25 changes: 13 additions & 12 deletions reflex-dom-core/src/Reflex/Dom/Builder/Class.hs
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ import Control.Monad.State.Strict
import Control.Monad.Trans.Control
import Data.Default
import Data.Functor.Misc
import Data.Kind (Type)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
@@ -67,20 +68,20 @@ import GHCJS.DOM.Types (JSM)
import qualified GHCJS.DOM.Types as DOM

class Default (EventSpec d EventResult) => DomSpace d where
type EventSpec d :: (EventTag -> *) -> *
type RawDocument d :: *
type RawTextNode d :: *
type RawCommentNode d :: *
type RawElement d :: *
type RawInputElement d :: *
type RawTextAreaElement d :: *
type RawSelectElement d :: *
type EventSpec d :: (EventTag -> Type) -> Type
type RawDocument d :: Type
type RawTextNode d :: Type
type RawCommentNode d :: Type
type RawElement d :: Type
type RawInputElement d :: Type
type RawTextAreaElement d :: Type
type RawSelectElement d :: Type
addEventSpecFlags :: proxy d -> EventName en -> (Maybe (er en) -> EventFlags) -> EventSpec d er -> EventSpec d er

-- | @'DomBuilder' t m@ indicates that @m@ is a 'Monad' capable of building
-- dynamic DOM in the 'Reflex' timeline @t@
class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable t m) => DomBuilder t m | m -> t where
type DomBuilderSpace m :: *
type DomBuilderSpace m :: Type
textNode :: TextNodeConfig t -> m (TextNode (DomBuilderSpace m) t)
default textNode :: ( MonadTrans f
, m ~ f m'
@@ -160,7 +161,7 @@ class (Monad m, Reflex t, DomSpace (DomBuilderSpace m), NotReady t m, Adjustable
{-# INLINABLE wrapRawElement #-}

class DomBuilder t m => MountableDomBuilder t m where
type DomFragment m :: *
type DomFragment m :: Type
buildDomFragment :: m a -> m (DomFragment m, a)
mountDomFragment :: DomFragment m -> Event t (DomFragment m) -> m ()

@@ -642,7 +643,7 @@ instance (DomBuilder t m, MonadFix m, MonadHold t m, Group q, Query q, Commutati
-- * Convenience functions

class HasDomEvent t target eventName | target -> t where
type DomEventType target eventName :: *
type DomEventType target eventName :: Type
domEvent :: EventName eventName -> target -> Event t (DomEventType target eventName)

instance Reflex t => HasDomEvent t (Element EventResult d t) en where
@@ -749,7 +750,7 @@ instance HasDocument m => HasDocument (RequesterT t request response m)
instance HasDocument m => HasDocument (QueryT t q m)

class HasSetValue a where
type SetValue a :: *
type SetValue a :: Type
setValue :: Lens' a (SetValue a)

instance Reflex t => HasSetValue (TextAreaElementConfig er t m) where
5 changes: 3 additions & 2 deletions reflex-dom-core/src/Reflex/Dom/Builder/Class/Events.hs
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ import Data.Type.Equality ((:~:)(..))
import Data.GADT.Compare
(GOrdering(..), GEq(..), GCompare(..))
#endif
import Data.Kind (Type)
import Data.Text (Text)

data EventTag
@@ -65,7 +66,7 @@ data EventTag
| TouchendTag
| TouchcancelTag

data EventName :: EventTag -> * where
data EventName :: EventTag -> Type where
Abort :: EventName 'AbortTag
Blur :: EventName 'BlurTag
Change :: EventName 'ChangeTag
@@ -115,7 +116,7 @@ data EventName :: EventTag -> * where

newtype EventResult en = EventResult { unEventResult :: EventResultType en }

type family EventResultType (en :: EventTag) :: * where
type family EventResultType (en :: EventTag) :: Type where
EventResultType 'ClickTag = ()
EventResultType 'DblclickTag = (Int, Int)
EventResultType 'KeypressTag = Word
5 changes: 3 additions & 2 deletions reflex-dom-core/src/Reflex/Dom/Builder/Immediate.hs
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ import Data.Functor.Product
import Data.GADT.Compare (GCompare)
import Data.IORef
import Data.IntMap.Strict (IntMap)
import Data.Kind (Type)
import Data.Maybe
import Data.Monoid ((<>))
import Data.Some (Some(..))
@@ -676,7 +677,7 @@ instance DomSpace GhcjsDomSpace where

newtype GhcjsEventFilter er en = GhcjsEventFilter (GhcjsDomEvent en -> JSM (EventFlags, JSM (Maybe (er en))))

data Pair1 (f :: k -> *) (g :: k -> *) (a :: k) = Pair1 (f a) (g a)
data Pair1 (f :: k -> Type) (g :: k -> Type) (a :: k) = Pair1 (f a) (g a)

data Maybe1 f a = Nothing1 | Just1 (f a)

@@ -1703,7 +1704,7 @@ instance (Adjustable t m, MonadJSM m, MonadHold t m, MonadFix m, PrimMonad m, Ra

{-# INLINABLE traverseDMapWithKeyWithAdjust' #-}
traverseDMapWithKeyWithAdjust'
:: forall s t m (k :: * -> *) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document)
:: forall s t m (k :: Type -> Type) v v'. (Adjustable t m, MonadHold t m, MonadFix m, MonadJSM m, PrimMonad m, GCompare k, RawDocument (DomBuilderSpace (HydrationDomBuilderT s t m)) ~ Document)
=> (forall a. k a -> v a -> HydrationDomBuilderT s t m (v' a))
-> DMap k v
-> Event t (PatchDMap k v)
5 changes: 3 additions & 2 deletions reflex-dom-core/src/Reflex/Dom/Builder/Static.hs
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ import qualified Data.IntMap as IntMap
import qualified Data.Map as Map
import Data.Map.Misc (applyMap)
import Data.Maybe (fromMaybe)
import Data.Kind (Type)
import Data.Monoid ((<>))
import qualified Data.Set as Set
import Data.Text (Text)
@@ -146,7 +147,7 @@ data StaticDomEvent (a :: k)
-- | Static documents don't process events, so all handlers are equivalent
data StaticDomHandler (a :: k) (b :: k) = StaticDomHandler

data StaticEventSpec (er :: EventTag -> *) = StaticEventSpec deriving (Generic)
data StaticEventSpec (er :: EventTag -> Type) = StaticEventSpec deriving (Generic)

instance Default (StaticEventSpec er)

@@ -221,7 +222,7 @@ hoistIntMapWithKeyWithAdjust base f im0 im' = do
sample o
return (result0, result')

hoistDMapWithKeyWithAdjust :: forall (k :: * -> *) v v' t m p.
hoistDMapWithKeyWithAdjust :: forall (k :: Type -> Type) v v' t m p.
( Adjustable t m
, MonadHold t m
, PatchTarget (p k (Constant (Behavior t Builder))) ~ DMap k (Constant (Behavior t Builder))
3 changes: 2 additions & 1 deletion reflex-dom-core/src/Reflex/Dom/Prerender.hs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import Control.Monad.Primitive (PrimMonad(..))
import Control.Monad.Reader
import Control.Monad.Ref (MonadRef(..), MonadAtomicRef(..))
import Data.IORef (IORef, newIORef)
import Data.Kind (Type)
import Data.Semigroup (Semigroup)
import Data.Semigroup.Commutative
import Data.Text (Text)
@@ -82,7 +83,7 @@ prerender_ server client = void $ prerender server client

class (PrerenderClientConstraint t (Client m), Client (Client m) ~ Client m, Prerender t (Client m)) => Prerender t m | m -> t where
-- | Monad in which the client widget is built
type Client m :: * -> *
type Client m :: Type -> Type
-- | Render the first widget on the server, and the second on the client. The
-- hydration builder will run *both* widgets, updating the result dynamic at
-- switchover time.
3 changes: 2 additions & 1 deletion reflex-dom-core/src/Reflex/Dom/Widget/Basic.hs
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@ import Data.Default
import Data.Either
import Data.Foldable
import Data.Functor (void)
import Data.Kind (Type)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Map.Misc
@@ -342,5 +343,5 @@ tabDisplay ulClass activeClass tabItems = do
return $ fmap (const k) (_link_clicked a)

class HasAttributes a where
type Attrs a :: *
type Attrs a :: Type
attributes :: Lens' a (Attrs a)
7 changes: 4 additions & 3 deletions reflex-dom-core/src/Reflex/Dom/Widget/Input.hs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import Data.Default
import Data.Dependent.Map (DMap)
import qualified Data.Dependent.Map as DMap
import Data.Functor.Misc
import Data.Kind (Type)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
@@ -233,7 +234,7 @@ checkbox checked config = do
, _checkbox_change = _inputElement_checkedChange i
}

type family CheckboxViewEventResultType (en :: EventTag) :: * where
type family CheckboxViewEventResultType (en :: EventTag) :: Type where
CheckboxViewEventResultType 'ClickTag = Bool
CheckboxViewEventResultType t = EventResultType t

@@ -369,7 +370,7 @@ instance Reflex t => Default (DropdownConfig t k) where
, _dropdownConfig_attributes = constDyn mempty
}

type family DropdownViewEventResultType (en :: EventTag) :: * where
type family DropdownViewEventResultType (en :: EventTag) :: Type where
DropdownViewEventResultType 'ChangeTag = Text
DropdownViewEventResultType t = EventResultType t

@@ -649,7 +650,7 @@ instance HasSetValue (CheckboxConfig t) where
setValue = checkboxConfig_setValue

class HasValue a where
type Value a :: *
type Value a :: Type
value :: a -> Value a

instance HasValue (InputElement er d t) where

0 comments on commit 2dd4b41

Please sign in to comment.