Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace ClassyPrelude with RIO in simple #194

Open
wants to merge 2 commits into
base: simple
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ version: "0.0.0"
dependencies:

- base >=4.9.1.0 && <5

- yesod >=1.6 && <1.7
- yesod-core >=1.6 && <1.7
- yesod-static >=1.6 && <1.7
- yesod-form >=1.6 && <1.7
- classy-prelude >=1.5 && <1.6
- classy-prelude-conduit >=1.5 && <1.6
- classy-prelude-yesod >=1.5 && <1.6

- rio >= 0.1.8.0
- http-types
- persistent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dependency and the next shouldn't be included in an actual simple template. I'm assuming it's here for testing/instances/etc.

- yesod-newsfeed

- bytestring >=0.10 && <0.11
- text >=0.11 && <2.0
- template-haskell
Expand Down
24 changes: 17 additions & 7 deletions src/Import/NoFoundation.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}

module Import.NoFoundation
( module Import
( module X
) where

import ClassyPrelude.Yesod as Import
import Settings as Import
import Settings.StaticFiles as Import
import Yesod.Core.Types as Import (loggerSet)
import Yesod.Default.Config2 as Import
import RIO.Yesod as X
import Data.Default as X (Default (..))
import Database.Persist.Sql as X (runMigration)
import Database.Persist.Sql as X (SqlBackend, SqlPersistT)
import Network.HTTP.Client.Conduit as X hiding (Proxy(..))
import Network.HTTP.Types as X
import Settings as X
import Settings.StaticFiles as X
import Yesod as X hiding (Header, parseTime)
import Yesod.Core.Types as X (loggerSet)
import Yesod.Default.Config2 as X
import Yesod.Feed as X
import Yesod.Static as X
20 changes: 20 additions & 0 deletions src/RIO/Yesod.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module RIO.Yesod
( module RIO
) where

import RIO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be possible to provide a HasLogFunc instance on the App type instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me get back to you n that — probably on Friday.

hiding
( Handler(..)
, LogLevel(..)
, LogSource
, logDebug
, logDebugS
, logError
, logErrorS
, logInfo
, logInfoS
, logOther
, logOtherS
, logWarn
, logWarnS
)
11 changes: 8 additions & 3 deletions src/Settings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@
-- declared in the Foundation.hs file.
module Settings where

import ClassyPrelude.Yesod
import RIO.Yesod
import qualified Control.Exception as Exception
import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?))
import Data.Aeson (Result (..), FromJSON(..), fromJSON,
withObject,(.:),(.!=),(.:?),Value(..))
import Data.Default (def)
import Data.FileEmbed (embedFile)
import Data.Yaml (decodeEither')
import Language.Haskell.TH.Syntax (Exp, Name, Q)
import Network.Wai.Handler.Warp (HostPreference)
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
import Yesod.Default.Util (WidgetFileSettings, widgetFileNoReload,
widgetFileReload)
import Yesod.Core.Types (Route)
import Yesod.Static (CombineSettings,combineScripts',
combineStylesheets', Static)


-- | Runtime settings to configure this application. These settings can be
-- loaded from various sources: defaults, environment variables, config files,
Expand Down
2 changes: 1 addition & 1 deletion test/TestImport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module TestImport
) where

import Application (makeFoundation, makeLogWare)
import ClassyPrelude as X hiding (Handler)
import RIO as X hiding (Handler)
import Foundation as X
import Test.Hspec as X
import Yesod.Default.Config2 (useEnv, loadYamlSettings)
Expand Down