From: Matthijs Kooijman Date: Wed, 3 Mar 2010 12:30:44 +0000 (+0100) Subject: Use fromMaybe with an error message instead of fromJust. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=254a259d6cfa363ac4da8c69b665ce4ce2a29ee7;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Use fromMaybe with an error message instead of fromJust. --- diff --git "a/c\316\273ash/CLasH/VHDL/Generate.hs" "b/c\316\273ash/CLasH/VHDL/Generate.hs" index 1d8194d..afd1741 100644 --- "a/c\316\273ash/CLasH/VHDL/Generate.hs" +++ "b/c\316\273ash/CLasH/VHDL/Generate.hs" @@ -172,9 +172,13 @@ mkStateProcSm :: mkStateProcSm (old, new, res) = do let error_msg = "\nVHDL.mkSigDec: Can not make signal declaration for type: \n" ++ pprString res type_mark_old_maybe <- MonadState.lift tsType $ vhdlTy error_msg (Var.varType old) - let type_mark_old = Maybe.fromJust type_mark_old_maybe + let type_mark_old = Maybe.fromMaybe + (error $ "\nGenerate.mkStateProcSm: empty type for state? Type: " ++ pprString (Var.varType old)) + type_mark_old_maybe type_mark_res_maybe <- MonadState.lift tsType $ vhdlTy error_msg (Var.varType res) - let type_mark_res' = Maybe.fromJust type_mark_res_maybe + let type_mark_res' = Maybe.fromMaybe + (error $ "\nGenerate.mkStateProcSm: empty type for initial state? Type: " ++ pprString (Var.varType res)) + type_mark_res_maybe let type_mark_res = if type_mark_old == type_mark_res' then type_mark_res' else