hunk ./CSSTest.hs 13 - [ StAtRule (AtCharset "UTF-8") - , StAtRule (AtImport (fromJust (parseURI "http://example.com/style.css")) [Screen, Projection]) - , StAtRule (AtImport (fromJust (parseURI "http://example.com/style2.css")) []) - , StAtRule (AtMedia [Braille, Embossed] []) + [ Statement (AtCharset "UTF-8") + , Statement (AtImport (fromJust (parseURI "http://example.com/style.css")) [Screen, Projection]) + , Statement (AtImport (fromJust (parseURI "http://example.com/style2.css")) []) + , Statement (AtMedia [Braille, Embossed] []) hunk ./Language/CSS/Syntax.hs 3 - , Statement(..) + , Statement + , AnyStatement(..) hunk ./Language/CSS/Syntax.hs 15 +{- Classes -} + +class Pretty a => Statement a + + hunk ./Language/CSS/Syntax.hs 22 -newtype StyleSheet = StyleSheet [Statement] - +data AnyStatement = forall a. Statement a => Statement a hunk ./Language/CSS/Syntax.hs 24 -data Statement - = StAtRule AtRule - | StRuleSet RuleSet hunk ./Language/CSS/Syntax.hs 25 +newtype StyleSheet = StyleSheet [AnyStatement] hunk ./Language/CSS/Syntax.hs 27 + hunk ./Language/CSS/Syntax.hs 54 - pretty (StyleSheet st) - = vcat (map pretty st) - - -instance Pretty Statement where - pretty (StAtRule atRule) - = pretty atRule + pretty (StyleSheet ss) + = vcat (map pr' ss) + where + pr' :: AnyStatement -> Doc + pr' (Statement s) = pretty s hunk ./Language/CSS/Syntax.hs 60 - pretty (StRuleSet ruleSet) - = pretty ruleSet hunk ./Language/CSS/Syntax.hs 61 +instance Statement AtRule hunk ./Language/CSS/Syntax.hs 95 +instance Statement RuleSet hunk ./css.cabal 21 + Extensions: + ExistentialQuantification hunk ./css.cabal 30 - + Extensions: + ExistentialQuantification