From 0a3b09f5ee2ff15f0613424d859d586bf29a14c1 Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 27 Sep 2018 14:37:46 +0200 Subject: [PATCH] Stubs, needs work, does not compile --- src/Import/NoFoundation.hs | 28 +--------------------------- src/Utils.hs | 2 ++ src/index.md | 3 +++ 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/Import/NoFoundation.hs b/src/Import/NoFoundation.hs index 9f54c8256..19d0bb34d 100644 --- a/src/Import/NoFoundation.hs +++ b/src/Import/NoFoundation.hs @@ -1,13 +1,10 @@ {-# LANGUAGE CPP #-} -{- # LANGUAGE FlexibleInstances, FlexibleContexts #-} -{- # LANGUAGE OverloadedStrings #-} module Import.NoFoundation ( module Import , addMessage, addMessageI ) where -import ClassyPrelude.Yesod as Import hiding (formatTime, derivePersistFieldJSON) -- , addMessage, addMessageI) --- import qualified ClassyPrelude.Yesod (addMessage, addMessageI) +import ClassyPrelude.Yesod as Import hiding (formatTime, derivePersistFieldJSON, addMessage, addMessageI) import Model as Import import Model.Types.JSON as Import import Model.Migration as Import @@ -29,26 +26,3 @@ import Text.Lucius as Import import Text.Shakespeare.Text as Import hiding (text, stext) import Data.Universe as Import - -{- -data MessageClass = Danger | Warning | Info - deriving (Eq,Ord,Enum,Bounded) - -instance PathPiece MessageClass where - toPathPiece Danger = "danger" - toPathPiece Warning = "warning" - toPathPiece Info = "info" --- fromPathPiece = finiteFromPathPiece -- not available here - fromPathPiece "danger" = Just Danger - fromPathPiece "warning" = Just Warning - fromPathPiece "info" = Just Info - fromPathPiece _ = Nothing - - -addMessage :: MonadHandler m => MessageClass-> Html -> m () -addMessage mc = ClassyPrelude.Yesod.addMessage (toPathPiece mc) - -addMessageI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => MessageClass -> msg -> m () -addMessageI mc = ClassyPrelude.Yesod.addMessageI (toPathPiece mc) - - -} diff --git a/src/Utils.hs b/src/Utils.hs index 50a95d4b1..08343ec80 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -25,6 +25,8 @@ import Utils.DB as Utils import Utils.TH as Utils import Utils.DateTime as Utils import Utils.PathPiece as Utils +import Utils.Message as Utils + import Text.Blaze (Markup, ToMarkup) diff --git a/src/index.md b/src/index.md index eb0870ba4..a1c616b17 100644 --- a/src/index.md +++ b/src/index.md @@ -19,6 +19,9 @@ Utils.Form Utils.PathPiece : (Template-Haskell)-Hilfsfunktionen für Formulierung von PathPiece-Instanzen +Utils.Message + : redefines addMessage, addMessageI, defines MessageClass + Utils.Lens : Automatisch erzeugt Linsen für eigene und Yesod-Typen, `Control.Lens`-Export