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)

View file

@ -9,6 +9,7 @@ git-annex (6.20180410) UNRELEASED; urgency=medium
as the move does not result in there being fewer copies.
* Fix mangling of --json output of utf-8 characters when not
running in a utf-8 locale.
* Fix build with yesod 1.6.
-- Joey Hess <id@joeyh.name> Mon, 09 Apr 2018 14:03:28 -0400

View file

@ -47,7 +47,11 @@ hamletTemplate f = globFile "hamlet" f
#endif
{- Lift Handler to Widget -}
#if MIN_VERSION_yesod_core(1,6,0)
liftH :: HandlerFor site a -> WidgetFor site a
#else
liftH :: Monad m => HandlerT site m a -> WidgetT site m a
#endif
liftH = handlerToWidget
#if ! MIN_VERSION_yesod_core(1,2,20)