module Tokstyle.C.TravUtils where import Language.C.Analysis.TravMonad (MonadTrav, throwTravError) import Language.C.Data.Error (userErr) getJust :: MonadTrav m => String -> Maybe a -> m a getJust :: String -> Maybe a -> m a getJust String _ (Just a ok) = a -> m a forall (m :: * -> *) a. Monad m => a -> m a return a ok getJust String failMsg Maybe a Nothing = UserError -> m a forall (m :: * -> *) e a. (MonadCError m, Error e) => e -> m a throwTravError (UserError -> m a) -> UserError -> m a forall a b. (a -> b) -> a -> b $ String -> UserError userErr String failMsg