on master help sign in
Add invalid serialization errors to Module.hs
4a11189Michael Sondergaard
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 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 }