on master help sign in
Merge pull request #321 from Sheeo/sourcesyntax-matches
5bde7cfEvan Czaplicki
compiler/SourceSyntax/Declaration.hs+4−3
@@ -43,6 +43,7 @@ instance Pretty (Declaration t v) where
43 let alias = P.text name <+> P.hsep (map P.text tvars) in
43 let alias = P.text name <+> P.hsep (map P.text tvars) in
44 P.hang (P.text "type" <+> alias <+> P.equals) 4 (pretty tipe)
44 P.hang (P.text "type" <+> alias <+> P.equals) 4 (pretty tipe)
45
45
46− -- TODO: actually write out the other cases. They are currently unused, but
46+ -- TODO: Actually write out the contained data in these cases.
47− -- this is probably going to be a bug someday.
47+ ImportEvent _ _ _ _ -> P.text (show decl)
48+ ExportEvent _ _ _ -> P.text (show decl)
48− _ -> P.text (show decl)
49+ Fixity _ _ _ -> P.text (show decl)
compiler/SourceSyntax/Module.hs+6−1
@@ -42,6 +42,7 @@ instance Binary ImportMethod where
42 0 -> liftM As get
42 0 -> liftM As get
43 1 -> liftM Importing get
43 1 -> liftM Importing get
44 2 -> liftM Hiding get
44 2 -> liftM Hiding get
45+ _ -> error "Error reading valid ImportMethod type from serialized string"
45
46
46data MetadataModule t v = MetadataModule {
47data MetadataModule t v = MetadataModule {
47 names :: [String],
48 names :: [String],
@@ -83,6 +84,10 @@ instance Binary ModuleInterface where
83
84
84instance Binary Assoc where
85instance Binary Assoc where
85 get = do n <- getWord8
86 get = do n <- getWord8
86− return $ case n of { 0 -> L ; 1 -> N ; 2 -> R }
87+ return $ case n of
88+ 0 -> L
89+ 1 -> N
90+ 2 -> R
91+ _ -> error "Error reading valid associativity from serialized string"
87
92
88 put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 }
93 put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 }
compiler/SourceSyntax/Type.hs+2−1
@@ -93,4 +93,5 @@ instance Binary Type where
93 1 -> Var <$> get
93 1 -> Var <$> get
94 2 -> Data <$> get <*> get
94 2 -> Data <$> get <*> get
95 3 -> return EmptyRecord
95 3 -> return EmptyRecord
96− 4 -> Record <$> get <*> get
96+ 4 -> Record <$> get <*> get
97+ _ -> error "Error reading a valid type from serialized string"