add a few more instances of Cellular and export it

This commit is contained in:
Andrew Martin 2017-09-25 10:31:22 -04:00
parent 7e002f9d5b
commit 16457188fe
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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 @\<tfoot\>@, its inner @\<tr\>@, and its inner @\<th\>@.
-- | 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