on master help sign in
Switch to new format for Expr, Def, and Module
commit3af5c2a652e16784c5c702e20f3f1be6a35df758 authorEvan Czaplicki <info@elm-lang.org> dateThu 2 Jan 2014, 23:37 (13 years ago) parente8389ac
2 files changed+10−11
compiler/Generate/Noscript.hs+8−9 compiler/Metadata/Prelude.hs+2−2
compiler/Generate/Noscript.hs+8−9
@@ -1,35 +1,34 @@
11module Generate.Noscript (noscript) where
22
33import Data.List (isInfixOf)
4−import SourceSyntax.Declaration (Declaration(..))
4+import qualified SourceSyntax.Declaration as D
55import SourceSyntax.Expression
66import SourceSyntax.Literal
77import SourceSyntax.Location
88import SourceSyntax.Module
99import qualified Generate.Markdown as MD
1010
11−noscript :: Module t v -> String
11+noscript :: Extract def => Module def -> String
1212noscript modul = concat (extract modul)
1313
1414class Extract a where
1515 extract :: a -> [String]
1616
17−instance Extract (Module t v) where
17+instance Extract def => Extract (Module def) where
1818 extract (Module _ _ _ stmts) =
1919 map (\s -> "<p>" ++ s ++ "</p>") (concatMap extract stmts)
2020
21−instance Extract (Declaration t v) where
22− extract (Definition d) = extract d
21+instance Extract def => Extract (D.Declaration' port def) where
22+ extract (D.Definition d) = extract d
2323 extract _ = []
2424
25−instance Extract (Def t v) where
26− extract (Def _ e) = extract e
27− extract _ = []
25+instance Extract Def where
26+ extract (Definition _ e _) = extract e
2827
2928instance Extract e => Extract (Located e) where
3029 extract (L _ e) = extract e
3130
32−instance Extract (Expr t v) where
31+instance Extract def => Extract (Expr' def) where
3332 extract expr =
3433 let f = extract in
3534 case expr of
compiler/Metadata/Prelude.hs+2−2
@@ -13,8 +13,8 @@ import qualified Data.ByteString.Lazy as BS
1313
1414import qualified InterfaceSerialization as IS
1515
16−add :: Module t v -> Module t v
17−add (Module name exs ims stmts) = Module name exs (customIms ++ ims) stmts
16+add :: Module def -> Module def
17+add (Module name exs ims decls) = Module name exs (customIms ++ ims) decls
1818 where
1919 customIms = concatMap addModule prelude
2020