[Print type errors withing checkBidirectionalizability Joachim Breitner **20100916144425 Ignore-this: c0c240c506ca6946860d165636baf569 ] hunk ./SemSyn.hs 206 -checkBidirectionalizability ast = - case (checkTreeless $ eraseType ast, checkAffine $ eraseType ast) of - (Nothing, Nothing) -> Nothing - (Just (e,d),Nothing) -> Just $ showTreelessError (e,d) - (Nothing, Just (vs,d')) -> Just $ showAffineError (vs,d') - (Just (e,d), Just (vs,d')) -> Just $ showTreelessError (e,d) ++ "\n" ++ showAffineError (vs,d') +checkBidirectionalizability ast = if isEmpty msgs then Nothing else Just (show msgs) hunk ./SemSyn.hs 208 + msgs = + either (text.showTypeError) (const empty) (typeInference ast) $$ + maybe empty (text.showTreelessError) (checkTreeless $ eraseType ast) $$ + maybe empty (text.showAffineError) (checkAffine $ eraseType ast) + showTypeError err + = show $ text "Error: program does not typecheck" $$ + nest 4 (text err) hunk ./SemSyn.hs 216 - = show $ (text "Error: program is not treeless due to expression" $$ + = show $ text "Error: program is not treeless due to expression" $$ hunk ./SemSyn.hs 219 - nest 4 (ppr d)) + nest 4 (ppr d) hunk ./SemSyn.hs 221 - = show $ (text "Error: program is not affine due to variables" $$ + = show $ text "Error: program is not affine due to variables" $$ hunk ./SemSyn.hs 224 - nest 4 (ppr d)) + nest 4 (ppr d)