@@ -1,35 +1,34 @@
1module Generate.Noscript (noscript) where
1module Generate.Noscript (noscript) where
3import Data.List (isInfixOf)
3import Data.List (isInfixOf)
4−import SourceSyntax.Declaration (Declaration(..))
4+import qualified SourceSyntax.Declaration as D
5import SourceSyntax.Expression
5import SourceSyntax.Expression
6import SourceSyntax.Literal
6import SourceSyntax.Literal
7import SourceSyntax.Location
7import SourceSyntax.Location
8import SourceSyntax.Module
8import SourceSyntax.Module
9import qualified Generate.Markdown as MD
9import qualified Generate.Markdown as MD
11−noscript :: Module t v -> String
11+noscript :: Extract def => Module def -> String
12noscript modul = concat (extract modul)
12noscript modul = concat (extract modul)
14class Extract a where
14class Extract a where
15 extract :: a -> [String]
15 extract :: a -> [String]
17−instance Extract (Module t v) where
17+instance Extract def => Extract (Module def) where
18 extract (Module _ _ _ stmts) =
18 extract (Module _ _ _ stmts) =
19 map (\s -> "<p>" ++ s ++ "</p>") (concatMap extract stmts)
19 map (\s -> "<p>" ++ s ++ "</p>") (concatMap extract stmts)
21−instance Extract (Declaration t v) where
21+instance Extract def => Extract (D.Declaration' port def) where
22− extract (Definition d) = extract d
22+ extract (D.Definition d) = extract d
23 extract _ = []
23 extract _ = []
25−instance Extract (Def t v) where
25+instance Extract Def where
26− extract (Def _ e) = extract e
26+ extract (Definition _ e _) = extract e
29instance Extract e => Extract (Located e) where
28instance Extract e => Extract (Located e) where
30 extract (L _ e) = extract e
29 extract (L _ e) = extract e
32−instance Extract (Expr t v) where
31+instance Extract def => Extract (Expr' def) where
33 extract expr =
32 extract expr =
34 let f = extract in
33 let f = extract in
35 case expr of
34 case expr of