From: Matthijs Kooijman Date: Thu, 6 Aug 2009 17:18:48 +0000 (+0200) Subject: Add hasNonEmptyType helper function. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=ef43775fa674c03d7dda3a6795aa04810dc09baa;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add hasNonEmptyType helper function. --- diff --git "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" index eabb1b4..a16ea01 100644 --- "a/c\316\273ash/CLasH/VHDL/VHDLTools.hs" +++ "b/c\316\273ash/CLasH/VHDL/VHDLTools.hs" @@ -728,3 +728,8 @@ mkSigDec bndr = do case type_mark_maybe of Just type_mark -> return $ Just (AST.SigDec (varToVHDLId bndr) type_mark Nothing) Nothing -> return Nothing + +-- | Does the given thing have a non-empty type? +hasNonEmptyType :: (TypedThing t, Outputable.Outputable t) => + t -> TranslatorSession Bool +hasNonEmptyType thing = MonadState.lift tsType $ isJustM (vhdl_ty "hasNonEmptyType: Non representable type?" thing)