Fix build with yesod 1.6.

Also avoid some depreaction warnings.
This commit is contained in:
Joey Hess 2018-04-22 13:56:35 -04:00
parent 1cb300e68a
commit aebf9e6dd5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 19 additions and 0 deletions

View file

@ -7,6 +7,7 @@
{-# LANGUAGE FlexibleContexts, TypeFamilies, QuasiQuotes #-}
{-# LANGUAGE MultiParamTypeClasses, TemplateHaskell #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings, RankNTypes #-}
module Assistant.WebApp.Form where
@ -67,7 +68,11 @@ withExpandableNote field (toggle, note) = withNote field $ [whamlet|
ident = "toggle_" ++ toggle
{- Adds a check box to an AForm to control encryption. -}
#if MIN_VERSION_yesod_core(1,6,0)
enableEncryptionField :: (RenderMessage site FormMessage) => AForm (HandlerFor site) EnableEncryption
#else
enableEncryptionField :: (RenderMessage site FormMessage) => AForm (HandlerT site IO) EnableEncryption
#endif
enableEncryptionField = areq (selectFieldList choices) (bfs "Encryption") (Just SharedEncryption)
where
choices :: [(Text, EnableEncryption)]

View file

@ -8,6 +8,7 @@
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell, OverloadedStrings, RankNTypes #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts, ViewPatterns #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Assistant.WebApp.Types (
@ -94,7 +95,11 @@ instance LiftAnnex Handler where
, liftAssistant $ liftAnnex a
)
#if MIN_VERSION_yesod_core(1,6,0)
instance LiftAnnex (WidgetFor WebApp) where
#else
instance LiftAnnex (WidgetT WebApp IO) where
#endif
liftAnnex = liftH . liftAnnex
class LiftAssistant m where
@ -104,7 +109,11 @@ instance LiftAssistant Handler where
liftAssistant a = liftIO . flip runAssistant a
=<< assistantData <$> getYesod
#if MIN_VERSION_yesod_core(1,6,0)
instance LiftAssistant (WidgetFor WebApp) where
#else
instance LiftAssistant (WidgetT WebApp IO) where
#endif
liftAssistant = liftH . liftAssistant
type MkMForm x = MForm Handler (FormResult x, Widget)