From f61bba8fbd7f596e503e67eac1b57945e81a709d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 30 Jul 2017 18:06:44 +0200 Subject: Clean up build somewhat --- Foundation.hs | 8 -------- Handler/Common.hs | 2 -- Handler/InventoryListing.hs | 4 ++-- Handler/List.hs | 5 ++--- Handler/ReferenceListing.hs | 6 +++--- Handler/Types.hs | 1 - Handler/UpdateItem.hs | 2 +- Model.hs | 2 +- bar.cabal | 2 +- bar.nix | 2 +- 10 files changed, 11 insertions(+), 23 deletions(-) diff --git a/Foundation.hs b/Foundation.hs index 8f45202..444547b 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -7,14 +7,6 @@ import Text.Hamlet (hamletFile) import Yesod.Core.Types (Logger) import qualified Yesod.Core.Unsafe as Unsafe -import qualified Data.Text.Encoding as TE -import qualified Data.Text.Encoding.Error as TEE - -import Data.Map.Lazy (Map) -import qualified Data.Map.Lazy as Map - -import Network.Wai (requestHeaders) - -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application -- starts running, such as database connections. Every handler will have diff --git a/Handler/Common.hs b/Handler/Common.hs index ab84e4e..88cbd8d 100644 --- a/Handler/Common.hs +++ b/Handler/Common.hs @@ -32,8 +32,6 @@ import Database.Persist.Sql (fromSqlKey) import qualified Web.Hashids as HID import Data.List ((\\)) -import Data.List.NonEmpty (NonEmpty) -import Data.Semigroup hiding (First(..)) import Data.Monoid (First(..)) import Data.Time.Calendar diff --git a/Handler/InventoryListing.hs b/Handler/InventoryListing.hs index d87512a..c61c62b 100644 --- a/Handler/InventoryListing.hs +++ b/Handler/InventoryListing.hs @@ -10,7 +10,7 @@ postInventoryListingR = do case insertResult of FormSuccess (Item{..} `WithType` t) -> runDB $ do - upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] + void $ upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] newItem <- insert Item{..} otherItems <- selectKeysList [ ItemNormKind ==. itemNormKind, ItemId !=. newItem ] [] when (not $ null otherItems) . addMessage "insertAmbiguous" $ @@ -42,5 +42,5 @@ putInventoryListingR :: Handler Value putInventoryListingR = do (Item{..} `WithType` t) <- requireCheckJsonBody returnJson <=< runDB $ do - upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] + void $ upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] withType =<< insertEntity Item{..} diff --git a/Handler/List.hs b/Handler/List.hs index e28bb16..522f6f5 100644 --- a/Handler/List.hs +++ b/Handler/List.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE PatternGuards #-} + module Handler.List where import Import @@ -5,14 +7,11 @@ import Import import Data.Set (Set) import qualified Data.Set as Set -import Data.Map (Map) import qualified Data.Map as Map import qualified Data.Text as Text import qualified Data.Text.Lazy as Lazy.Text -import Database.Persist.Sql (Single(..), rawSql) - import Thermoprint.Client list :: Handler (Set (WithType Text)) diff --git a/Handler/ReferenceListing.hs b/Handler/ReferenceListing.hs index 690f3f7..9fda87f 100644 --- a/Handler/ReferenceListing.hs +++ b/Handler/ReferenceListing.hs @@ -11,8 +11,8 @@ postReferenceListingR = do case insertResult of FormSuccess (Reference{..} `WithType` t) -> runDB $ do - upsertBy (UniqueKind referenceNormKind) (Kind referenceNormKind t) [ KindType =. t ] - insert Reference{..} + void $ upsertBy (UniqueKind referenceNormKind) (Kind referenceNormKind t) [ KindType =. t ] + void $ insert Reference{..} return () FormFailure errors -> mapM_ (addMessage "formError" . toHtml) errors _ -> return () @@ -30,5 +30,5 @@ putReferenceListingR :: Handler Value putReferenceListingR = do (Reference{..} `WithType` referenceType) <- requireCheckJsonBody returnJson <=< runDB $ do - upsertBy (UniqueKind referenceNormKind) (Kind referenceNormKind referenceType) [ KindType =. referenceType ] + void $ upsertBy (UniqueKind referenceNormKind) (Kind referenceNormKind referenceType) [ KindType =. referenceType ] withType =<< insertEntity Reference{..} diff --git a/Handler/Types.hs b/Handler/Types.hs index 04055ad..2fc45a3 100644 --- a/Handler/Types.hs +++ b/Handler/Types.hs @@ -2,7 +2,6 @@ module Handler.Types where import Import -import Data.Set (Set) import qualified Data.Set as Set getTypesR :: Handler Value diff --git a/Handler/UpdateItem.hs b/Handler/UpdateItem.hs index ce6b30d..ebd29e4 100644 --- a/Handler/UpdateItem.hs +++ b/Handler/UpdateItem.hs @@ -13,7 +13,7 @@ postUpdateItemR fsUpdateId = do case updateResult of FormSuccess (Item{..} `WithType` t) -> runDB $ do - upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] + void $ upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] update fsUpdateId [ ItemKind =. itemKind , ItemNormKind =. itemNormKind , ItemBought =. itemBought diff --git a/Model.hs b/Model.hs index 15b9097..6d0fd04 100644 --- a/Model.hs +++ b/Model.hs @@ -12,7 +12,7 @@ import Control.Monad.Writer import Data.Text (Text) import qualified Data.Text as Text -import Data.Map (Map, (!)) +import Data.Map ((!)) import qualified Data.Map as Map import qualified Data.HashMap.Lazy as HashMap diff --git a/bar.cabal b/bar.cabal index 37eedf3..94dfacc 100644 --- a/bar.cabal +++ b/bar.cabal @@ -1,5 +1,5 @@ name: bar -version: 0.6.5 +version: 0.6.6 cabal-version: >= 1.8 build-type: Simple diff --git a/bar.nix b/bar.nix index c41d3f8..6121182 100644 --- a/bar.nix +++ b/bar.nix @@ -10,7 +10,7 @@ }: mkDerivation { pname = "bar"; - version = "0.6.5"; + version = "0.6.6"; src = ./.; isLibrary = true; isExecutable = true; -- cgit v1.2.3