module Web.Atomic.Attributes
  ( Attributable (..)
  , class_
  , att
  , Name
  , AttValue
  , Attributes
  ) where

import Data.Map.Strict qualified as M
import Web.Atomic.Types


class_ :: (Attributable h) => AttValue -> Attributes h -> Attributes h
class_ :: forall h.
Attributable h =>
AttValue -> Attributes h -> Attributes h
class_ AttValue
cnew (Attributes Map AttValue AttValue
m) =
  Map AttValue AttValue -> Attributes h
forall {k} (h :: k). Map AttValue AttValue -> Attributes h
Attributes (Map AttValue AttValue -> Attributes h)
-> Map AttValue AttValue -> Attributes h
forall a b. (a -> b) -> a -> b
$ (AttValue -> AttValue -> AttValue)
-> AttValue
-> AttValue
-> Map AttValue AttValue
-> Map AttValue AttValue
forall k a. Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
M.insertWith (\AttValue
a AttValue
b -> AttValue
a AttValue -> AttValue -> AttValue
forall a. Semigroup a => a -> a -> a
<> AttValue
" " AttValue -> AttValue -> AttValue
forall a. Semigroup a => a -> a -> a
<> AttValue
b) AttValue
"class" AttValue
cnew Map AttValue AttValue
m