-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Oops examples -- -- Oops examples. @package oops-examples @version 0.2.0.0 module Examples -- | A simple function that throws an error. -- -- The type is the one that is inferred by GHC. readIntV1 :: () => MonadError (Variant e) m => CouldBeF e Text => String -> m Int -- | A simple function that throws an error. -- -- This is the same as before, but we can rewrite constraint on -- e differently. readIntV2 :: () => MonadError (Variant e) m => e `CouldBe` Text => String -> m Int -- | A simple function that throws an error. -- -- We can also use ExceptT readIntV3 :: () => e `CouldBe` Text => String -> ExceptT (Variant e) Identity Int -- | A simple IO function that throws an error. -- -- We can also use ExceptT of IO. readIntV4 :: () => e `CouldBe` Text => String -> ExceptT (Variant e) IO Int -- | A simple function that throws an error. -- -- Or use MonadIO instead of IO directly. readIntV5 :: () => MonadError (Variant e) m => MonadIO m => e `CouldBe` Text => String -> m Int -- | A simple function that throws an error. -- -- Or use MonadIO with ExceptT. readIntV6 :: () => MonadIO m => e `CouldBe` Text => String -> ExceptT (Variant e) m Int data NotAnInteger NotAnInteger :: NotAnInteger data NotPositive NotPositive :: NotPositive -- | A simple function can throw two errors readPositiveInt1 :: () => MonadIO m => e `CouldBe` NotAnInteger => e `CouldBe` NotPositive => String -> ExceptT (Variant e) m Int example1 :: () => e `CouldBe` Text => String -> ExceptT (Variant e) IO Int example2 :: () => String -> ExceptT (Variant e) IO Int example3 :: () => String -> IO Int data FileNotFound FileNotFound :: FileNotFound data FileNotReadable FileNotReadable :: FileNotReadable data Errors1 Errors1NotPositive :: NotPositive -> Errors1 Errors1NotAnInteger :: NotAnInteger -> Errors1 example4 :: () => MonadIO m => e `CouldBe` Errors1 => String -> ExceptT (Variant e) m Int example5 :: () => MonadIO m => String -> ExceptT Errors1 m Int example6 :: () => MonadIO m => String -> m (Either Errors1 Int) example7 :: () => MonadIO m => e `CouldBe` NotPositive => e `CouldBe` NotAnInteger => String -> ExceptT (Variant e) m Int example8 :: () => MonadIO m => e `CouldBe` NotPositive => e `CouldBe` NotAnInteger => String -> ExceptT (Variant e) m Int example9 :: () => MonadIO m => e `CouldBe` NotPositive => e `CouldBe` NotAnInteger => String -> ExceptT (Variant e) m Int example10 :: () => MonadIO m => e `CouldBe` NotPositive => e `CouldBe` NotAnInteger => String -> ExceptT (Variant e) m Int example11 :: () => MonadIO m => MonadCatch m => e `CouldBe` IOException => ExceptT (Variant e) m String example12 :: () => MonadIO m => MonadCatch m => e `CouldBe` IOException => ExceptT (Variant e) m String