{-# LANGUAGE GeneralizedNewtypeDeriving #-}moduleClay.StylesheetwhereimportData.Text(Text)importControl.Monad.WriterimportClay.Selectorhiding(Child)importClay.PropertyimportClay.Common-------------------------------------------------------------------------------newtypeMediaType=MediaTypeValuederiving(Val,Other,Show)dataNotOrOnly=Not|OnlyderivingShowdataMediaQuery=MediaQuery(MaybeNotOrOnly)MediaType[Feature]derivingShowdataFeature=FeatureText(MaybeValue)derivingShow-------------------------------------------------------------------------------dataApp=SelfRefinement|RootSelector|PopInt|ChildSelector|SubSelectorderivingShowdataRule=Property(Key())Value|NestedApp[Rule]|QueryMediaQuery[Rule]derivingShownewtypeStyleMa=S(Writer[Rule]a)derivingMonad-- | The `Css` context is used to collect style rules which are mappings from-- selectors to style properties. The `Css` type is a computation in the-- `StyleM` monad that just collects and doesn't return anything.typeCss=StyleM()-- | Add a new style property to the stylesheet with the specified `Key` and-- value. The value can be any type that is in the `Val' typeclass, with other-- words: can be converted to a `Value`.key::Vala=>Keya->a->Csskeykv=S$tell[Property(castk)(valuev)]-- | Add a new style property to the stylesheet with the specified `Key` and-- value, like `key` but use a `Prefixed` key.prefixed::Vala=>Prefixed->a->Cssprefixedxs=key(Keyxs)infix4-:-- | The colon operator can be used to add style rules to the current context-- for which there is no embedded version available. Both the key and the value-- are plain text values and rendered as is to the output CSS.(-:)::KeyText->Text->Css(-:)=key-------------------------------------------------------------------------------infixr5<?infixr5?infixr5&-- | Assign a stylesheet to a selector. When the selector is nested inside an-- outer scope it will be composed with `deep`.(?)::Selector->Css->Css(?)sel(Srs)=S(tell[Nested(Subsel)(execWriterrs)])-- | Assign a stylesheet to a selector. When the selector is nested inside an-- outer scope it will be composed with `|>`.(<?)::Selector->Css->Css(<?)sel(Srs)=S(tell[Nested(Childsel)(execWriterrs)])-- | Assign a stylesheet to a filter selector. When the selector is nested-- inside an outer scope it will be composed with the `with` selector.(&)::Refinement->Css->Css(&)p(Srs)=S(tell[Nested(Selfp)(execWriterrs)])-- | Root is used to add style rules to the top scope.root::Selector->Css->Cssrootsel(Srs)=S(tell[Nested(Rootsel)(execWriterrs)])-- | Pop is used to add style rules to selectors defined in an outer scope. The-- counter specifies how far up the scope stack we want to add the rules.pop::Int->Css->Csspopi(Srs)=S(tell[Nested(Popi)(execWriterrs)])--------------------------------------------------------------------------------- | Apply a set of style rules when the media type and feature queries apply.query::MediaType->[Feature]->Css->Cssquerytyfs(Srs)=S(tell[Query(MediaQueryNothingtyfs)(execWriterrs)])-- | Apply a set of style rules when the media type and feature queries do not apply.queryNot::MediaType->[Feature]->Css->CssqueryNottyfs(Srs)=S(tell[Query(MediaQuery(JustNot)tyfs)(execWriterrs)])-- | Apply a set of style rules only when the media type and feature queries apply.queryOnly::MediaType->[Feature]->Css->CssqueryOnlytyfs(Srs)=S(tell[Query(MediaQuery(JustOnly)tyfs)(execWriterrs)])