{-# LANGUAGE CPP #-}
module React.Types where
import Control.Monad.Reader
import Data.String
import qualified Data.Text as T
import Language.Javascript.JSaddle hiding (Ref)
import React.JSaddle
newtype React = React { React -> Object
unReact :: Object }
instance MakeObject React where
makeObject :: React -> JSM Object
makeObject = Object -> JSM Object
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Object -> JSM Object) -> (React -> Object) -> React -> JSM Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. React -> Object
unReact
newtype Component props refVal = Component { Component props refVal -> Function'
unComponent :: Function' }
deriving ([Component props refVal] -> JSM JSVal
Component props refVal -> JSM JSVal
(Component props refVal -> JSM JSVal)
-> ([Component props refVal] -> JSM JSVal)
-> ToJSVal (Component props refVal)
forall a. (a -> JSM JSVal) -> ([a] -> JSM JSVal) -> ToJSVal a
forall props refVal. [Component props refVal] -> JSM JSVal
forall props refVal. Component props refVal -> JSM JSVal
toJSValListOf :: [Component props refVal] -> JSM JSVal
$ctoJSValListOf :: forall props refVal. [Component props refVal] -> JSM JSVal
toJSVal :: Component props refVal -> JSM JSVal
$ctoJSVal :: forall props refVal. Component props refVal -> JSM JSVal
ToJSVal, Component props refVal -> JSVal
(Component props refVal -> JSVal)
-> PToJSVal (Component props refVal)
forall a. (a -> JSVal) -> PToJSVal a
forall props refVal. Component props refVal -> JSVal
pToJSVal :: Component props refVal -> JSVal
$cpToJSVal :: forall props refVal. Component props refVal -> JSVal
PToJSVal)
instance MakeObject (Component props refVal) where
makeObject :: Component props refVal -> JSM Object
makeObject = Object -> JSM Object
forall this. MakeObject this => this -> JSM Object
makeObject (Object -> JSM Object)
-> (Component props refVal -> Object)
-> Component props refVal
-> JSM Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function' -> Object
functionObject' (Function' -> Object)
-> (Component props refVal -> Function')
-> Component props refVal
-> Object
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Component props refVal -> Function'
forall props refVal. Component props refVal -> Function'
unComponent
newtype Hook a = Hook { Hook a -> ReaderT React JSM a
unHook :: ReaderT React JSM a }
deriving ( a -> Hook b -> Hook a
(a -> b) -> Hook a -> Hook b
(forall a b. (a -> b) -> Hook a -> Hook b)
-> (forall a b. a -> Hook b -> Hook a) -> Functor Hook
forall a b. a -> Hook b -> Hook a
forall a b. (a -> b) -> Hook a -> Hook b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Hook b -> Hook a
$c<$ :: forall a b. a -> Hook b -> Hook a
fmap :: (a -> b) -> Hook a -> Hook b
$cfmap :: forall a b. (a -> b) -> Hook a -> Hook b
Functor
, Functor Hook
a -> Hook a
Functor Hook
-> (forall a. a -> Hook a)
-> (forall a b. Hook (a -> b) -> Hook a -> Hook b)
-> (forall a b c. (a -> b -> c) -> Hook a -> Hook b -> Hook c)
-> (forall a b. Hook a -> Hook b -> Hook b)
-> (forall a b. Hook a -> Hook b -> Hook a)
-> Applicative Hook
Hook a -> Hook b -> Hook b
Hook a -> Hook b -> Hook a
Hook (a -> b) -> Hook a -> Hook b
(a -> b -> c) -> Hook a -> Hook b -> Hook c
forall a. a -> Hook a
forall a b. Hook a -> Hook b -> Hook a
forall a b. Hook a -> Hook b -> Hook b
forall a b. Hook (a -> b) -> Hook a -> Hook b
forall a b c. (a -> b -> c) -> Hook a -> Hook b -> Hook c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Hook a -> Hook b -> Hook a
$c<* :: forall a b. Hook a -> Hook b -> Hook a
*> :: Hook a -> Hook b -> Hook b
$c*> :: forall a b. Hook a -> Hook b -> Hook b
liftA2 :: (a -> b -> c) -> Hook a -> Hook b -> Hook c
$cliftA2 :: forall a b c. (a -> b -> c) -> Hook a -> Hook b -> Hook c
<*> :: Hook (a -> b) -> Hook a -> Hook b
$c<*> :: forall a b. Hook (a -> b) -> Hook a -> Hook b
pure :: a -> Hook a
$cpure :: forall a. a -> Hook a
$cp1Applicative :: Functor Hook
Applicative
, Applicative Hook
a -> Hook a
Applicative Hook
-> (forall a b. Hook a -> (a -> Hook b) -> Hook b)
-> (forall a b. Hook a -> Hook b -> Hook b)
-> (forall a. a -> Hook a)
-> Monad Hook
Hook a -> (a -> Hook b) -> Hook b
Hook a -> Hook b -> Hook b
forall a. a -> Hook a
forall a b. Hook a -> Hook b -> Hook b
forall a b. Hook a -> (a -> Hook b) -> Hook b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Hook a
$creturn :: forall a. a -> Hook a
>> :: Hook a -> Hook b -> Hook b
$c>> :: forall a b. Hook a -> Hook b -> Hook b
>>= :: Hook a -> (a -> Hook b) -> Hook b
$c>>= :: forall a b. Hook a -> (a -> Hook b) -> Hook b
$cp1Monad :: Applicative Hook
Monad
, Applicative Hook
MonadIO Hook
Applicative Hook
-> MonadIO Hook -> (forall a. JSM a -> Hook a) -> MonadJSM Hook
JSM a -> Hook a
forall a. JSM a -> Hook a
forall (m :: * -> *).
Applicative m
-> MonadIO m -> (forall a. JSM a -> m a) -> MonadJSM m
liftJSM' :: JSM a -> Hook a
$cliftJSM' :: forall a. JSM a -> Hook a
$cp2MonadJSM :: MonadIO Hook
$cp1MonadJSM :: Applicative Hook
MonadJSM
#ifndef ghcjs_HOST_OS
, Monad Hook
Monad Hook -> (forall a. IO a -> Hook a) -> MonadIO Hook
IO a -> Hook a
forall a. IO a -> Hook a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> Hook a
$cliftIO :: forall a. IO a -> Hook a
$cp1MonadIO :: Monad Hook
MonadIO
#endif
)
newtype Element = Element { Element -> ReaderT React JSM JSVal
unElement :: ReaderT React JSM JSVal }
instance IsString Element where
fromString :: String -> Element
fromString = ReaderT React JSM JSVal -> Element
Element (ReaderT React JSM JSVal -> Element)
-> (String -> ReaderT React JSM JSVal) -> String -> Element
forall b c a. (b -> c) -> (a -> b) -> a -> c
. JSVal -> ReaderT React JSM JSVal
forall (f :: * -> *) a. Applicative f => a -> f a
pure (JSVal -> ReaderT React JSM JSVal)
-> (String -> JSVal) -> String -> ReaderT React JSM JSVal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> JSVal
forall a. PToJSVal a => a -> JSVal
pToJSVal (Text -> JSVal) -> (String -> Text) -> String -> JSVal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack
newtype Tag = Tag { Tag -> JSVal
unTag :: JSVal }
instance IsString Tag where
fromString :: String -> Tag
fromString = JSVal -> Tag
Tag (JSVal -> Tag) -> (String -> JSVal) -> String -> Tag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> JSVal
forall a. PToJSVal a => a -> JSVal
pToJSVal (Text -> JSVal) -> (String -> Text) -> String -> JSVal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack