Skip to content

Commit

Permalink
version 0.1.1.7: polymorphic throwJson (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksbotan authored and ozzzzz committed Sep 18, 2019
1 parent 66d6bbe commit 46eb230
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.1.7] - 2019-09-18
### Changed
- `throwJson` type is more polymorphic to match `throwIO` and similar.

## [0.1.1.6] - 2019-09-13
### Added
- `MonadWebError` type class with `throwJson` function.
Expand Down
4 changes: 2 additions & 2 deletions src/Web/Template/Except.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ class MonadWebError m where
-- | Throw any 'ToJSON'able value with custom HTTP code. The value will be sent
-- directly as response without any additional formatting.
--
throwJson :: (Show a, ToJSON a) => Status -> a -> m ()
throwJson :: (Show e, ToJSON e) => Status -> e -> m a

-- | Specialized version of 'throwJson' that uses @500 Internal Server Error@ code.
{-# INLINE throwJson500 #-}
throwJson500 :: (Show a, ToJSON a) => a -> m ()
throwJson500 :: (Show e, ToJSON e) => e -> m a
throwJson500 = throwJson status500

instance Monad m => MonadWebError (ActionT Except m) where
Expand Down
2 changes: 1 addition & 1 deletion web-template.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: web-template
version: 0.1.1.6
version: 0.1.1.7
synopsis: Web template
description:
Web template includes:
Expand Down

0 comments on commit 46eb230

Please sign in to comment.