diff --git a/reflex-dom-colonnade/reflex-dom-colonnade.cabal b/reflex-dom-colonnade/reflex-dom-colonnade.cabal index e9c79f9..dc769cf 100644 --- a/reflex-dom-colonnade/reflex-dom-colonnade.cabal +++ b/reflex-dom-colonnade/reflex-dom-colonnade.cabal @@ -26,6 +26,7 @@ library , reflex-dom == 0.4.* , containers >= 0.5 && < 0.6 , profunctors >= 5.2 && < 5.3 + , transformers >= 0.5 && < 0.6 default-language: Haskell2010 source-repository head diff --git a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs index 2e7add2..6a53ab2 100644 --- a/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs +++ b/reflex-dom-colonnade/src/Reflex/Dom/Colonnade.hs @@ -23,6 +23,8 @@ module Reflex.Dom.Colonnade , Bureau(..) , Arrangement(..) , Pagination(..) + -- * Typeclasses + , Cellular(..) -- * Table Encoders , basic , static @@ -71,6 +73,7 @@ import Data.Monoid (Sum(..)) import Data.Proxy import Control.Monad.Fix (MonadFix) import Control.Monad (forM) +import Control.Monad.Trans.Reader (ReaderT) import qualified Colonnade as C import qualified Colonnade.Encode as E @@ -121,6 +124,7 @@ data Arrangement t (Dynamic t (Map Text Text)) -- ^ contains attributes of @\@, its inner @\@, and its inner @\@. +-- | Things that can be rendered as cells in a table. class (PostBuild t m, DomBuilder t m) => Cellular t m c | c -> m, c -> t where cellularAttrs :: c b -> Dynamic t (Map Text Text) cellularContents :: c b -> m b @@ -132,6 +136,14 @@ instance (PostBuild t m, DomBuilder t m) => Cellular t m (Cell t m) where instance (Reflex t, DomBuilder t m, PerformEvent t m, MonadHold t m, MonadFix m) => Cellular t (PostBuildT t m) (PostBuildT t m) where cellularAttrs _ = pure M.empty cellularContents = id + +instance Cellular t m m => Cellular t (ReaderT r m) (ReaderT r m) where + cellularAttrs _ = pure M.empty + cellularContents = id + +instance (Cellular t m m, MonadHold t m, MonadFix m, Semigroup w) => Cellular t (EventWriterT t w m) (EventWriterT t w m) where + cellularAttrs _ = pure M.empty + cellularContents = id -- | This typeclass is provided to make using functions in this