Merge pull request #321 from Sheeo/sourcesyntax-matches

Incomplete matches in sourcesyntax
This commit is contained in:
Evan Czaplicki 2013-11-11 06:29:55 -08:00
commit 5bde7cf4b5
3 changed files with 12 additions and 5 deletions

View file

@ -43,6 +43,7 @@ instance Pretty (Declaration t v) where
let alias = P.text name <+> P.hsep (map P.text tvars) in let alias = P.text name <+> P.hsep (map P.text tvars) in
P.hang (P.text "type" <+> alias <+> P.equals) 4 (pretty tipe) P.hang (P.text "type" <+> alias <+> P.equals) 4 (pretty tipe)
-- TODO: actually write out the other cases. They are currently unused, but -- TODO: Actually write out the contained data in these cases.
-- this is probably going to be a bug someday. ImportEvent _ _ _ _ -> P.text (show decl)
_ -> P.text (show decl) ExportEvent _ _ _ -> P.text (show decl)
Fixity _ _ _ -> P.text (show decl)

View file

@ -42,6 +42,7 @@ instance Binary ImportMethod where
0 -> liftM As get 0 -> liftM As get
1 -> liftM Importing get 1 -> liftM Importing get
2 -> liftM Hiding get 2 -> liftM Hiding get
_ -> error "Error reading valid ImportMethod type from serialized string"
data MetadataModule t v = MetadataModule { data MetadataModule t v = MetadataModule {
names :: [String], names :: [String],
@ -83,6 +84,10 @@ instance Binary ModuleInterface where
instance Binary Assoc where instance Binary Assoc where
get = do n <- getWord8 get = do n <- getWord8
return $ case n of { 0 -> L ; 1 -> N ; 2 -> R } return $ case n of
0 -> L
1 -> N
2 -> R
_ -> error "Error reading valid associativity from serialized string"
put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 } put assoc = putWord8 $ case assoc of { L -> 0 ; N -> 1 ; R -> 2 }

View file

@ -94,3 +94,4 @@ instance Binary Type where
2 -> Data <$> get <*> get 2 -> Data <$> get <*> get
3 -> return EmptyRecord 3 -> return EmptyRecord
4 -> Record <$> get <*> get 4 -> Record <$> get <*> get
_ -> error "Error reading a valid type from serialized string"