Merge branch 'master' into 85-entfernen-von-vorigen-aufgabenstellungen-eines-ubungsblattes-funktioniert-nicht
This commit is contained in:
commit
8bce5b102a
48
package.yaml
48
package.yaml
@ -111,6 +111,54 @@ dependencies:
|
|||||||
- mmorph
|
- mmorph
|
||||||
- clientsession
|
- clientsession
|
||||||
|
|
||||||
|
other-extensions:
|
||||||
|
- GeneralizedNewtypeDeriving
|
||||||
|
- IncoherentInstances
|
||||||
|
- OverloadedLists
|
||||||
|
- UndecidableInstances
|
||||||
|
|
||||||
|
default-extensions:
|
||||||
|
- OverloadedStrings
|
||||||
|
- PartialTypeSignatures
|
||||||
|
- ScopedTypeVariables
|
||||||
|
- TemplateHaskell
|
||||||
|
- QuasiQuotes
|
||||||
|
- CPP
|
||||||
|
- TypeSynonymInstances
|
||||||
|
- KindSignatures
|
||||||
|
- ConstraintKinds
|
||||||
|
- ViewPatterns
|
||||||
|
- TypeOperators
|
||||||
|
- TupleSections
|
||||||
|
- TypeFamilies
|
||||||
|
- GADTs
|
||||||
|
- StandaloneDeriving
|
||||||
|
- RecordWildCards
|
||||||
|
- RankNTypes
|
||||||
|
- PatternGuards
|
||||||
|
- PatternSynonyms
|
||||||
|
- ParallelListComp
|
||||||
|
- NumDecimals
|
||||||
|
- MultiWayIf
|
||||||
|
- NamedFieldPuns
|
||||||
|
- NoImplicitPrelude
|
||||||
|
- LambdaCase
|
||||||
|
- MultiParamTypeClasses
|
||||||
|
- FlexibleContexts
|
||||||
|
- FlexibleInstances
|
||||||
|
- FunctionalDependencies
|
||||||
|
- EmptyDataDecls
|
||||||
|
- ExistentialQuantification
|
||||||
|
- DefaultSignatures
|
||||||
|
- DeriveDataTypeable
|
||||||
|
- DeriveGeneric
|
||||||
|
- DeriveLift
|
||||||
|
- DeriveFunctor
|
||||||
|
- DerivingStrategies
|
||||||
|
- DataKinds
|
||||||
|
- BinaryLiterals
|
||||||
|
- PolyKinds
|
||||||
|
|
||||||
# The library contains all of our application code. The executable
|
# The library contains all of our application code. The executable
|
||||||
# defined below is just a thin wrapper.
|
# defined below is just a thin wrapper.
|
||||||
library:
|
library:
|
||||||
|
|||||||
@ -1,15 +1,5 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE RankNTypes #-}
|
|
||||||
{-# LANGUAGE DataKinds #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Application
|
module Application
|
||||||
( getApplicationDev, getAppDevSettings
|
( getApplicationDev, getAppDevSettings
|
||||||
, appMain
|
, appMain
|
||||||
@ -29,7 +19,7 @@ module Application
|
|||||||
import Control.Monad.Logger (liftLoc, LoggingT(..), MonadLoggerIO(..))
|
import Control.Monad.Logger (liftLoc, LoggingT(..), MonadLoggerIO(..))
|
||||||
import Database.Persist.Postgresql (createPostgresqlPool, pgConnStr,
|
import Database.Persist.Postgresql (createPostgresqlPool, pgConnStr,
|
||||||
pgPoolSize, runSqlPool)
|
pgPoolSize, runSqlPool)
|
||||||
import Import hiding (Proxy)
|
import Import
|
||||||
import Language.Haskell.TH.Syntax (qLocation)
|
import Language.Haskell.TH.Syntax (qLocation)
|
||||||
import Network.Wai (Middleware)
|
import Network.Wai (Middleware)
|
||||||
import Network.Wai.Handler.Warp (Settings, defaultSettings,
|
import Network.Wai.Handler.Warp (Settings, defaultSettings,
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, TemplateHaskell
|
|
||||||
, FlexibleContexts
|
|
||||||
, TypeFamilies
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Auth.Dummy
|
module Auth.Dummy
|
||||||
( dummyLogin
|
( dummyLogin
|
||||||
, DummyMessage(..)
|
, DummyMessage(..)
|
||||||
|
|||||||
@ -1,14 +1,3 @@
|
|||||||
{-# LANGUAGE RecordWildCards
|
|
||||||
, OverloadedStrings
|
|
||||||
, TemplateHaskell
|
|
||||||
, ViewPatterns
|
|
||||||
, TypeFamilies
|
|
||||||
, FlexibleContexts
|
|
||||||
, FlexibleInstances
|
|
||||||
, NoImplicitPrelude
|
|
||||||
, ScopedTypeVariables
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Auth.LDAP
|
module Auth.LDAP
|
||||||
( campusLogin
|
( campusLogin
|
||||||
, CampusUserException(..)
|
, CampusUserException(..)
|
||||||
|
|||||||
@ -1,13 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, QuasiQuotes
|
|
||||||
, TemplateHaskell
|
|
||||||
, ViewPatterns
|
|
||||||
, RecordWildCards
|
|
||||||
, OverloadedStrings
|
|
||||||
, FlexibleContexts
|
|
||||||
, TypeFamilies
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Auth.PWHash
|
module Auth.PWHash
|
||||||
( hashLogin
|
( hashLogin
|
||||||
, PWHashMessage(..)
|
, PWHashMessage(..)
|
||||||
|
|||||||
@ -1,12 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, PatternGuards
|
|
||||||
, ViewPatterns
|
|
||||||
, DeriveFunctor
|
|
||||||
, TemplateHaskell
|
|
||||||
, NamedFieldPuns
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Cron
|
module Cron
|
||||||
( CronNextMatch(..)
|
( CronNextMatch(..)
|
||||||
, nextCronMatch
|
, nextCronMatch
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, DuplicateRecordFields
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Cron.Types
|
module Cron.Types
|
||||||
( Cron(..), Crontab
|
( Cron(..), Crontab
|
||||||
, CronMatch(..)
|
, CronMatch(..)
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE DataKinds #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
|
|
||||||
{-# LANGUAGE RecordWildCards, ViewPatterns, PatternGuards #-}
|
|
||||||
{-# LANGUAGE PatternSynonyms #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module CryptoID
|
module CryptoID
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
|
|
||||||
module CryptoID.TH where
|
module CryptoID.TH where
|
||||||
|
|
||||||
import ClassyPrelude
|
import ClassyPrelude
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Data.CaseInsensitive.Instances
|
module Data.CaseInsensitive.Instances
|
||||||
() where
|
(
|
||||||
|
) where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, ScopedTypeVariables
|
|
||||||
#-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Data.Universe.Instances.Reverse.Hashable
|
module Data.Universe.Instances.Reverse.Hashable
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, ScopedTypeVariables
|
|
||||||
#-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Data.Universe.Instances.Reverse.JSON
|
module Data.Universe.Instances.Reverse.JSON
|
||||||
|
|||||||
@ -1,17 +1,4 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
{-# LANGUAGE PatternSynonyms #-}
|
|
||||||
{-# LANGUAGE DataKinds #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE PatternGuards, MultiWayIf #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances, UndecidableInstances, FlexibleContexts #-}
|
|
||||||
|
|
||||||
module Foundation where
|
module Foundation where
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,3 @@
|
|||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
|
|
||||||
module Handler.Admin where
|
module Handler.Admin where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
-- | Common handler functions.
|
-- | Common handler functions.
|
||||||
module Handler.Common where
|
module Handler.Common where
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE MultiWayIf, LambdaCase #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns, TupleSections #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE RankNTypes #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
|
|
||||||
module Handler.Corrections where
|
module Handler.Corrections where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,18 +1,3 @@
|
|||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns, TupleSections #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
|
|
||||||
module Handler.Course where
|
module Handler.Course where
|
||||||
|
|
||||||
import Import hiding (catMaybes)
|
import Import hiding (catMaybes)
|
||||||
|
|||||||
@ -1,23 +1,9 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, DataKinds
|
|
||||||
, KindSignatures
|
|
||||||
, TypeFamilies
|
|
||||||
, FlexibleInstances
|
|
||||||
, TypeOperators
|
|
||||||
, RankNTypes
|
|
||||||
, PolyKinds
|
|
||||||
, RecordWildCards
|
|
||||||
, MultiParamTypeClasses
|
|
||||||
, ScopedTypeVariables
|
|
||||||
, ViewPatterns
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.CryptoIDDispatch
|
module Handler.CryptoIDDispatch
|
||||||
( getCryptoUUIDDispatchR
|
( getCryptoUUIDDispatchR
|
||||||
, getCryptoFileNameDispatchR
|
, getCryptoFileNameDispatchR
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import hiding (Proxy)
|
import Import
|
||||||
|
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,3 @@
|
|||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE IncoherentInstances #-} -- why is this needed? Instance for "display deadline" ought to be clear
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,17 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE MultiWayIf, LambdaCase #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE PatternSynonyms #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
|
|
||||||
module Handler.Profile where
|
module Handler.Profile where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,18 +1,3 @@
|
|||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns, TupleSections #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
|
|
||||||
module Handler.School where
|
module Handler.School where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,20 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE RankNTypes #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE MultiWayIf, LambdaCase #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
|
||||||
|
|
||||||
module Handler.Sheet where
|
module Handler.Sheet where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,21 +1,3 @@
|
|||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE OverloadedLists #-}
|
|
||||||
{-# LANGUAGE ParallelListComp #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE PatternGuards #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
|
|
||||||
module Handler.Submission where
|
module Handler.Submission where
|
||||||
|
|
||||||
import Import hiding (joinPath)
|
import Import hiding (joinPath)
|
||||||
@ -314,14 +296,15 @@ submissionHelper tid ssh csh shn (SubmissionMode mcid) = do
|
|||||||
, dbtProj = return . dbrOutput
|
, dbtProj = return . dbrOutput
|
||||||
, dbtStyle = def
|
, dbtStyle = def
|
||||||
, dbtIdent = "files" :: Text
|
, dbtIdent = "files" :: Text
|
||||||
, dbtSorting = [ ( "path"
|
, dbtSorting = Map.fromList
|
||||||
, SortColumn $ \((sf1 `E.InnerJoin` f1) `E.FullOuterJoin` (sf2 `E.InnerJoin` f2)) -> E.coalesce [f1 E.?. FileTitle, f2 E.?. FileTitle]
|
[ ( "path"
|
||||||
)
|
, SortColumn $ \((sf1 `E.InnerJoin` f1) `E.FullOuterJoin` (sf2 `E.InnerJoin` f2)) -> E.coalesce [f1 E.?. FileTitle, f2 E.?. FileTitle]
|
||||||
, ( "time"
|
)
|
||||||
, SortColumn $ \((sf1 `E.InnerJoin` f1) `E.FullOuterJoin` (sf2 `E.InnerJoin` f2)) -> (E.unsafeSqlFunction "GREATEST" ([f1 E.?. FileModified, f2 E.?. FileModified] :: [E.SqlExpr (E.Value (Maybe UTCTime))]) :: E.SqlExpr (E.Value (Maybe UTCTime)))
|
, ( "time"
|
||||||
)
|
, SortColumn $ \((sf1 `E.InnerJoin` f1) `E.FullOuterJoin` (sf2 `E.InnerJoin` f2)) -> (E.unsafeSqlFunction "GREATEST" ([f1 E.?. FileModified, f2 E.?. FileModified] :: [E.SqlExpr (E.Value (Maybe UTCTime))]) :: E.SqlExpr (E.Value (Maybe UTCTime)))
|
||||||
]
|
)
|
||||||
, dbtFilter = []
|
]
|
||||||
|
, dbtFilter = Map.empty
|
||||||
}
|
}
|
||||||
mFileTable <- traverse (fmap snd . dbTable def) . fmap smid2ArchiveTable $ (,) <$> msmid <*> mcid
|
mFileTable <- traverse (fmap snd . dbTable def) . fmap smid2ArchiveTable $ (,) <$> msmid <*> mcid
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, TemplateHaskell
|
|
||||||
, NamedFieldPuns
|
|
||||||
, RecordWildCards
|
|
||||||
, OverloadedStrings
|
|
||||||
, TypeFamilies
|
|
||||||
, ViewPatterns
|
|
||||||
, FlexibleContexts
|
|
||||||
, LambdaCase
|
|
||||||
, MultiParamTypeClasses
|
|
||||||
, QuasiQuotes
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.SystemMessage where
|
module Handler.SystemMessage where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,19 +1,8 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, OverloadedStrings
|
|
||||||
, OverloadedLists
|
|
||||||
, RecordWildCards
|
|
||||||
, TemplateHaskell
|
|
||||||
, QuasiQuotes
|
|
||||||
, MultiParamTypeClasses
|
|
||||||
, TypeFamilies
|
|
||||||
, FlexibleContexts
|
|
||||||
, PartialTypeSignatures
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.Term where
|
module Handler.Term where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
import Handler.Utils
|
import Handler.Utils
|
||||||
|
import qualified Data.Map as Map
|
||||||
|
|
||||||
-- import qualified Data.Text as T
|
-- import qualified Data.Text as T
|
||||||
import Yesod.Form.Bootstrap3
|
import Yesod.Form.Bootstrap3
|
||||||
@ -111,30 +100,32 @@ getTermShowR = do
|
|||||||
{ dbtSQLQuery = termData
|
{ dbtSQLQuery = termData
|
||||||
, dbtColonnade = colonnadeTerms
|
, dbtColonnade = colonnadeTerms
|
||||||
, dbtProj = return . dbrOutput
|
, dbtProj = return . dbrOutput
|
||||||
, dbtSorting = [ ( "start"
|
, dbtSorting = Map.fromList
|
||||||
, SortColumn $ \term -> term E.^. TermStart
|
[ ( "start"
|
||||||
)
|
, SortColumn $ \term -> term E.^. TermStart
|
||||||
, ( "end"
|
)
|
||||||
, SortColumn $ \term -> term E.^. TermEnd
|
, ( "end"
|
||||||
)
|
, SortColumn $ \term -> term E.^. TermEnd
|
||||||
, ( "lecture-start"
|
)
|
||||||
, SortColumn $ \term -> term E.^. TermLectureStart
|
, ( "lecture-start"
|
||||||
)
|
, SortColumn $ \term -> term E.^. TermLectureStart
|
||||||
, ( "lecture-end"
|
)
|
||||||
, SortColumn $ \term -> term E.^. TermLectureEnd
|
, ( "lecture-end"
|
||||||
)
|
, SortColumn $ \term -> term E.^. TermLectureEnd
|
||||||
]
|
)
|
||||||
, dbtFilter = [ ( "active"
|
]
|
||||||
, FilterColumn $ \term -> (term E.^. TermActive :: E.SqlExpr (E.Value Bool))
|
, dbtFilter = Map.fromList
|
||||||
)
|
[ ( "active"
|
||||||
, ( "course"
|
, FilterColumn $ \term -> (term E.^. TermActive :: E.SqlExpr (E.Value Bool))
|
||||||
, FilterColumn $ \term csh -> case csh of -- FilterColumn-Lambdas are
|
)
|
||||||
[] -> E.val True :: E.SqlExpr (E.Value Bool)
|
, ( "course"
|
||||||
cshs -> E.exists . E.from $ \course -> do
|
, FilterColumn $ \term csh -> case csh of -- FilterColumn-Lambdas are
|
||||||
E.where_ $ course E.^. CourseTerm E.==. term E.^. TermId
|
[] -> E.val True :: E.SqlExpr (E.Value Bool)
|
||||||
E.&&. course E.^. CourseShorthand `E.in_` E.valList cshs
|
cshs -> E.exists . E.from $ \course -> do
|
||||||
)
|
E.where_ $ course E.^. CourseTerm E.==. term E.^. TermId
|
||||||
]
|
E.&&. course E.^. CourseShorthand `E.in_` E.valList cshs
|
||||||
|
)
|
||||||
|
]
|
||||||
, dbtStyle = def
|
, dbtStyle = def
|
||||||
, dbtIdent = "terms" :: Text
|
, dbtIdent = "terms" :: Text
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE RecordWildCards, NamedFieldPuns #-}
|
|
||||||
|
|
||||||
module Handler.Users where
|
module Handler.Users where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TypeFamilies, FlexibleContexts, ConstraintKinds #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
|
|
||||||
|
|
||||||
module Handler.Utils
|
module Handler.Utils
|
||||||
( module Handler.Utils
|
( module Handler.Utils
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
, RecordWildCards
|
|
||||||
, TypeFamilies
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.Utils.DateTime
|
module Handler.Utils.DateTime
|
||||||
( utcToLocalTime
|
( utcToLocalTime
|
||||||
, localTimeToUTC, TZ.LocalToUTCResult(..)
|
, localTimeToUTC, TZ.LocalToUTCResult(..)
|
||||||
|
|||||||
@ -1,17 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE PatternGuards #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Form
|
module Handler.Utils.Form
|
||||||
( module Handler.Utils.Form
|
( module Handler.Utils.Form
|
||||||
, module Utils.Form
|
, module Utils.Form
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Form.Types where
|
module Handler.Utils.Form.Types where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, NamedFieldPuns
|
|
||||||
, TypeFamilies
|
|
||||||
, FlexibleContexts
|
|
||||||
, ViewPatterns
|
|
||||||
, LambdaCase
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.Utils.Mail
|
module Handler.Utils.Mail
|
||||||
( addRecipientsDB
|
( addRecipientsDB
|
||||||
, userMailT
|
, userMailT
|
||||||
|
|||||||
@ -1,16 +1,4 @@
|
|||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric, DeriveDataTypeable #-}
|
|
||||||
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Rating
|
module Handler.Utils.Rating
|
||||||
( Rating(..), Rating'(..)
|
( Rating(..), Rating'(..)
|
||||||
|
|||||||
@ -1,13 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Sheet where
|
module Handler.Utils.Sheet where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.Utils.StudyFeatures
|
module Handler.Utils.StudyFeatures
|
||||||
( parseStudyFeatures
|
( parseStudyFeatures
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,19 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric, DeriveDataTypeable #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
|
|
||||||
|
|
||||||
module Handler.Utils.Submission
|
module Handler.Utils.Submission
|
||||||
( AssignSubmissionException(..)
|
( AssignSubmissionException(..)
|
||||||
, assignSubmissions
|
, assignSubmissions
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, ViewPatterns
|
|
||||||
, OverloadedStrings
|
|
||||||
, StandaloneDeriving
|
|
||||||
, DeriveLift
|
|
||||||
#-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Handler.Utils.Submission.TH
|
module Handler.Utils.Submission.TH
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Table where
|
module Handler.Utils.Table where
|
||||||
-- General Utilities for Tables
|
-- General Utilities for Tables
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE PartialTypeSignatures #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Table.Cells where
|
module Handler.Utils.Table.Cells where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|||||||
@ -1,23 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, ExistentialQuantification
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
, OverloadedStrings
|
|
||||||
, TemplateHaskell
|
|
||||||
, QuasiQuotes
|
|
||||||
, LambdaCase
|
|
||||||
, ViewPatterns
|
|
||||||
, FlexibleContexts
|
|
||||||
, FlexibleInstances
|
|
||||||
, MultiParamTypeClasses
|
|
||||||
, TypeFamilies
|
|
||||||
, ScopedTypeVariables
|
|
||||||
, TupleSections
|
|
||||||
, RankNTypes
|
|
||||||
, MultiWayIf
|
|
||||||
, FunctionalDependencies
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.Utils.Table.Pagination
|
module Handler.Utils.Table.Pagination
|
||||||
( SortColumn(..), SortDirection(..)
|
( SortColumn(..), SortDirection(..)
|
||||||
, FilterColumn(..), IsFilterColumn
|
, FilterColumn(..), IsFilterColumn
|
||||||
@ -47,7 +27,7 @@ module Handler.Utils.Table.Pagination
|
|||||||
import Handler.Utils.Table.Pagination.Types
|
import Handler.Utils.Table.Pagination.Types
|
||||||
import Utils.Lens.TH
|
import Utils.Lens.TH
|
||||||
|
|
||||||
import Import hiding (Proxy(..))
|
import Import
|
||||||
import qualified Database.Esqueleto as E
|
import qualified Database.Esqueleto as E
|
||||||
import qualified Database.Esqueleto.Internal.Sql as E (SqlSelect,unsafeSqlValue)
|
import qualified Database.Esqueleto.Internal.Sql as E (SqlSelect,unsafeSqlValue)
|
||||||
import qualified Database.Esqueleto.Internal.Language as E (From)
|
import qualified Database.Esqueleto.Internal.Language as E (From)
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, ExistentialQuantification
|
|
||||||
, RankNTypes
|
|
||||||
, RecordWildCards
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Handler.Utils.Table.Pagination.Types where
|
module Handler.Utils.Table.Pagination.Types where
|
||||||
|
|
||||||
import Import hiding (singleton)
|
import Import hiding (singleton)
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude, TemplateHaskell, QuasiQuotes #-}
|
|
||||||
|
|
||||||
module Handler.Utils.Templates where
|
module Handler.Utils.Templates where
|
||||||
|
|
||||||
import Data.Either (isLeft)
|
import Data.Either (isLeft)
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric, DeriveDataTypeable #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-missing-fields #-} -- This concerns zipEntrySize in produceZip
|
{-# OPTIONS_GHC -fno-warn-missing-fields #-} -- This concerns zipEntrySize in produceZip
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
|
||||||
module Import.NoFoundation
|
module Import.NoFoundation
|
||||||
( module Import
|
( module Import
|
||||||
, MForm
|
, MForm
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod as Import hiding (formatTime, derivePersistFieldJSON, addMessage, addMessageI, (.=), MForm)
|
import ClassyPrelude.Yesod as Import hiding (formatTime, derivePersistFieldJSON, addMessage, addMessageI, (.=), MForm, Proxy)
|
||||||
import Model as Import
|
import Model as Import
|
||||||
import Model.Types.JSON as Import
|
import Model.Types.JSON as Import
|
||||||
import Model.Migration as Import
|
import Model.Migration as Import
|
||||||
|
|||||||
17
src/Jobs.hs
17
src/Jobs.hs
@ -1,29 +1,14 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
, FlexibleContexts
|
|
||||||
, ViewPatterns
|
|
||||||
, TypeFamilies
|
|
||||||
, DeriveGeneric
|
|
||||||
, DeriveDataTypeable
|
|
||||||
, QuasiQuotes
|
|
||||||
, NamedFieldPuns
|
|
||||||
, MultiWayIf
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
( module Types
|
( module Types
|
||||||
, module Jobs.Queue
|
, module Jobs.Queue
|
||||||
, handleJobs
|
, handleJobs
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import hiding (Proxy)
|
import Import
|
||||||
|
|
||||||
import Jobs.Types as Types hiding (JobCtl(JobCtlQueue))
|
import Jobs.Types as Types hiding (JobCtl(JobCtlQueue))
|
||||||
import Jobs.Types (JobCtl(JobCtlQueue))
|
import Jobs.Types (JobCtl(JobCtlQueue))
|
||||||
import Jobs.Queue
|
import Jobs.Queue
|
||||||
import Jobs.TH
|
|
||||||
import Jobs.Crontab
|
import Jobs.Crontab
|
||||||
|
|
||||||
import Data.Conduit.TMChan
|
import Data.Conduit.TMChan
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, FlexibleContexts
|
|
||||||
, MultiWayIf
|
|
||||||
, NamedFieldPuns
|
|
||||||
, TypeFamilies
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Crontab
|
module Jobs.Crontab
|
||||||
( determineCrontab
|
( determineCrontab
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, RecordWildCards
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.HelpRequest
|
module Jobs.Handler.HelpRequest
|
||||||
( dispatchJobHelpRequest
|
( dispatchJobHelpRequest
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.QueueNotification
|
module Jobs.Handler.QueueNotification
|
||||||
( dispatchJobQueueNotification
|
( dispatchJobQueueNotification
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,14 +1,9 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SendNotification
|
module Jobs.Handler.SendNotification
|
||||||
( dispatchJobSendNotification
|
( dispatchJobSendNotification
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
|
||||||
import Jobs.TH
|
|
||||||
import Jobs.Types
|
import Jobs.Types
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SendNotification.CorrectionsAssigned
|
module Jobs.Handler.SendNotification.CorrectionsAssigned
|
||||||
( dispatchNotificationCorrectionsAssigned
|
( dispatchNotificationCorrectionsAssigned
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SendNotification.SheetActive
|
module Jobs.Handler.SendNotification.SheetActive
|
||||||
( dispatchNotificationSheetActive
|
( dispatchNotificationSheetActive
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SendNotification.SheetInactive
|
module Jobs.Handler.SendNotification.SheetInactive
|
||||||
( dispatchNotificationSheetSoonInactive
|
( dispatchNotificationSheetSoonInactive
|
||||||
, dispatchNotificationSheetInactive
|
, dispatchNotificationSheetInactive
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SendNotification.SubmissionRated
|
module Jobs.Handler.SendNotification.SubmissionRated
|
||||||
( dispatchNotificationSubmissionRated
|
( dispatchNotificationSubmissionRated
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
, NamedFieldPuns
|
|
||||||
, QuasiQuotes
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SendTestEmail
|
module Jobs.Handler.SendTestEmail
|
||||||
( dispatchJobSendTestEmail
|
( dispatchJobSendTestEmail
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Handler.SetLogSettings
|
module Jobs.Handler.SetLogSettings
|
||||||
( dispatchJobSetLogSettings
|
( dispatchJobSetLogSettings
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TypeFamilies
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Queue
|
module Jobs.Queue
|
||||||
( writeJobCtl, writeJobCtlBlock
|
( writeJobCtl, writeJobCtlBlock
|
||||||
, queueJob, queueJob'
|
, queueJob, queueJob'
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, QuasiQuotes
|
|
||||||
, RecordWildCards
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.TH
|
|
||||||
( dispatchTH
|
|
||||||
) where
|
|
||||||
|
|
||||||
import ClassyPrelude
|
|
||||||
|
|
||||||
import Language.Haskell.TH
|
|
||||||
import Language.Haskell.TH.Datatype
|
|
||||||
|
|
||||||
import Data.List (foldl)
|
|
||||||
|
|
||||||
|
|
||||||
dispatchTH :: Name -- ^ Datatype to pattern match
|
|
||||||
-> ExpQ
|
|
||||||
dispatchTH dType = do
|
|
||||||
DatatypeInfo{..} <- reifyDatatype dType
|
|
||||||
let
|
|
||||||
matches = map mkMatch datatypeCons
|
|
||||||
mkMatch ConstructorInfo{..} = do
|
|
||||||
pats <- forM constructorFields $ \_ -> newName "x"
|
|
||||||
let fName = mkName $ "dispatch" <> nameBase constructorName
|
|
||||||
match (conP constructorName $ map varP pats) (normalB $ foldl (\e pat -> e `appE` varE pat) (varE fName) pats) []
|
|
||||||
lamCaseE matches
|
|
||||||
@ -1,9 +1,3 @@
|
|||||||
{-# LANGUAGE TemplateHaskell
|
|
||||||
, NoImplicitPrelude
|
|
||||||
, DeriveGeneric
|
|
||||||
, DeriveDataTypeable
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Jobs.Types
|
module Jobs.Types
|
||||||
( Job(..), Notification(..)
|
( Job(..), Notification(..)
|
||||||
, JobCtl(..)
|
, JobCtl(..)
|
||||||
|
|||||||
19
src/Mail.hs
19
src/Mail.hs
@ -1,22 +1,5 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
{-# LANGUAGE GeneralizedNewtypeDeriving
|
||||||
, GeneralizedNewtypeDeriving
|
|
||||||
, DerivingStrategies
|
|
||||||
, FlexibleInstances
|
|
||||||
, MultiParamTypeClasses
|
|
||||||
, UndecidableInstances
|
, UndecidableInstances
|
||||||
, DeriveGeneric
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
, RecordWildCards
|
|
||||||
, FlexibleContexts
|
|
||||||
, TypeFamilies
|
|
||||||
, ViewPatterns
|
|
||||||
, NamedFieldPuns
|
|
||||||
, MultiWayIf
|
|
||||||
, QuasiQuotes
|
|
||||||
, RankNTypes
|
|
||||||
, ScopedTypeVariables
|
|
||||||
, DeriveDataTypeable
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
module Mail
|
module Mail
|
||||||
|
|||||||
19
src/Model.hs
19
src/Model.hs
@ -1,17 +1,4 @@
|
|||||||
{-# LANGUAGE EmptyDataDecls #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE GADTs #-}
|
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE DeriveDataTypeable #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE StandaloneDeriving #-}
|
|
||||||
|
|
||||||
|
|
||||||
module Model
|
module Model
|
||||||
( module Model
|
( module Model
|
||||||
@ -45,11 +32,5 @@ share [mkPersist sqlSettings, mkDeleteCascade sqlSettings, mkMigrate "migrateAll
|
|||||||
-- (Eq Course) is impossible so we derive it for the Uniqueness Constraint only
|
-- (Eq Course) is impossible so we derive it for the Uniqueness Constraint only
|
||||||
deriving instance Eq (Unique Course)
|
deriving instance Eq (Unique Course)
|
||||||
|
|
||||||
data PWEntry = PWEntry
|
|
||||||
{ pwUser :: User
|
|
||||||
, pwHash :: Text
|
|
||||||
} deriving (Show)
|
|
||||||
$(deriveJSON defaultOptions ''PWEntry)
|
|
||||||
|
|
||||||
submissionRatingDone :: Submission -> Bool
|
submissionRatingDone :: Submission -> Bool
|
||||||
submissionRatingDone Submission{..} = isJust submissionRatingTime
|
submissionRatingDone Submission{..} = isJust submissionRatingTime
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE ExistentialQuantification #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
|
|
||||||
module Model.Migration
|
module Model.Migration
|
||||||
( migrateAll
|
( migrateAll
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE PatternSynonyms #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE StandaloneDeriving #-}
|
|
||||||
{-# LANGUAGE DeriveLift, DeriveGeneric, DeriveDataTypeable #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Model.Migration.Version
|
module Model.Migration.Version
|
||||||
|
|||||||
@ -1,16 +1,6 @@
|
|||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving
|
||||||
{-# LANGUAGE PatternGuards #-}
|
, UndecidableInstances
|
||||||
{-# LANGUAGE LambdaCase #-}
|
#-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE DerivingStrategies #-}
|
|
||||||
{-# LANGUAGE BinaryLiterals #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
{-- # LANGUAGE ExistentialQuantification #-} -- for DA type
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- for instance PathPiece (CI Text)
|
{-# OPTIONS_GHC -fno-warn-orphans #-} -- for instance PathPiece (CI Text)
|
||||||
|
|
||||||
module Model.Types
|
module Model.Types
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
|
|
||||||
|
|
||||||
module Model.Types.JSON
|
module Model.Types.JSON
|
||||||
( derivePersistFieldJSON
|
( derivePersistFieldJSON
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, ViewPatterns
|
|
||||||
, OverloadedStrings
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Model.Types.Wordlist (wordlist) where
|
module Model.Types.Wordlist (wordlist) where
|
||||||
|
|
||||||
import ClassyPrelude hiding (lift)
|
import ClassyPrelude hiding (lift)
|
||||||
|
|||||||
@ -1,17 +1,5 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
{-# LANGUAGE StandaloneDeriving #-}
|
|
||||||
{-# LANGUAGE DerivingStrategies #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
|
||||||
{-# LANGUAGE DataKinds #-}
|
|
||||||
{-# LANGUAGE KindSignatures #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
-- | Settings are centralized, as much as possible, into this file. This
|
-- | Settings are centralized, as much as possible, into this file. This
|
||||||
-- includes database connection settings, static file locations, etc.
|
-- includes database connection settings, static file locations, etc.
|
||||||
-- In addition, you can configure a number of different aspects of Yesod
|
-- In addition, you can configure a number of different aspects of Yesod
|
||||||
@ -22,7 +10,7 @@ module Settings
|
|||||||
, module Settings.Cluster
|
, module Settings.Cluster
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod hiding (Proxy)
|
import ClassyPrelude.Yesod
|
||||||
import Data.UUID (UUID)
|
import Data.UUID (UUID)
|
||||||
import qualified Control.Exception as Exception
|
import qualified Control.Exception as Exception
|
||||||
import Data.Aeson (Result (..), fromJSON, withObject
|
import Data.Aeson (Result (..), fromJSON, withObject
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, DataKinds
|
|
||||||
, TypeFamilies
|
|
||||||
, ScopedTypeVariables
|
|
||||||
, TemplateHaskell
|
|
||||||
, OverloadedStrings
|
|
||||||
, FlexibleContexts
|
|
||||||
#-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Settings.Cluster
|
module Settings.Cluster
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
module Settings.StaticFiles where
|
module Settings.StaticFiles where
|
||||||
|
|
||||||
import Settings (appStaticDir, compileTimeAppSettings)
|
import Settings (appStaticDir, compileTimeAppSettings)
|
||||||
|
|||||||
@ -1,12 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE DefaultSignatures #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE RankNTypes #-}
|
|
||||||
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE TypeFamilies, FlexibleContexts, ConstraintKinds #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes, TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-} -- Monad FormResult
|
{-# OPTIONS_GHC -fno-warn-orphans #-} -- Monad FormResult
|
||||||
|
|
||||||
module Utils
|
module Utils
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE TypeFamilies, FlexibleContexts, ConstraintKinds #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
|
|
||||||
module Utils.DB where
|
module Utils.DB where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
|
|||||||
@ -1,15 +1,4 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
, TemplateHaskell
|
|
||||||
, QuasiQuotes
|
|
||||||
, StandaloneDeriving
|
|
||||||
, DerivingStrategies
|
|
||||||
, DeriveLift
|
|
||||||
, DeriveDataTypeable
|
|
||||||
, DeriveGeneric
|
|
||||||
, GeneralizedNewtypeDeriving
|
|
||||||
, OverloadedStrings
|
|
||||||
, FlexibleInstances
|
|
||||||
#-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
module Utils.DateTime
|
module Utils.DateTime
|
||||||
|
|||||||
@ -1,18 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, TemplateHaskell
|
|
||||||
, ViewPatterns
|
|
||||||
, OverloadedStrings
|
|
||||||
, QuasiQuotes
|
|
||||||
, TemplateHaskell
|
|
||||||
, MultiParamTypeClasses
|
|
||||||
, TypeFamilies
|
|
||||||
, FlexibleContexts
|
|
||||||
, NamedFieldPuns
|
|
||||||
, ScopedTypeVariables
|
|
||||||
, MultiWayIf
|
|
||||||
, RecordWildCards
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Utils.Form where
|
module Utils.Form where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod hiding (addMessage)
|
import ClassyPrelude.Yesod hiding (addMessage)
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
|
|
||||||
module Utils.Lang where
|
module Utils.Lang where
|
||||||
|
|
||||||
import ClassyPrelude.Yesod
|
import ClassyPrelude.Yesod
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
||||||
{-# LANGUAGE FunctionalDependencies #-}
|
|
||||||
module Utils.Lens ( module Utils.Lens ) where
|
module Utils.Lens ( module Utils.Lens ) where
|
||||||
|
|
||||||
import Import.NoFoundation
|
import Import.NoFoundation
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
|
||||||
{-# LANGUAGE DeriveLift #-}
|
|
||||||
|
|
||||||
|
|
||||||
module Utils.Message
|
module Utils.Message
|
||||||
( MessageClass(..)
|
( MessageClass(..)
|
||||||
, addMessage, addMessageI, addMessageIHamlet, addMessageFile
|
, addMessage, addMessageI, addMessageIHamlet, addMessageFile
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Utils.PathPiece
|
module Utils.PathPiece
|
||||||
( finiteFromPathPiece
|
( finiteFromPathPiece
|
||||||
, nullaryToPathPiece
|
, nullaryToPathPiece
|
||||||
|
|||||||
@ -1,11 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE NumDecimals #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
|
|
||||||
module Utils.Sql
|
module Utils.Sql
|
||||||
( setSerializable
|
( setSerializable
|
||||||
) where
|
) where
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
{-# LANGUAGE NoImplicitPrelude
|
|
||||||
, RecordWildCards
|
|
||||||
#-}
|
|
||||||
|
|
||||||
module Utils.SystemMessage where
|
module Utils.SystemMessage where
|
||||||
|
|
||||||
import Import.NoFoundation
|
import Import.NoFoundation
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
|
||||||
|
|
||||||
module Utils.TH where
|
module Utils.TH where
|
||||||
-- Common Utility Functions that require TemplateHaskell
|
-- Common Utility Functions that require TemplateHaskell
|
||||||
|
|
||||||
@ -142,3 +136,16 @@ embedRenderMessageVariant f newT mangle = do
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
dispatchTH :: Name -- ^ Datatype to pattern match
|
||||||
|
-> ExpQ
|
||||||
|
-- ^ Produces a lambda-case-expression matching all constructors of the named datatype and calling a function (named after the constructor prefixed with @dispatch@) on the fields of each constructor
|
||||||
|
dispatchTH dType = do
|
||||||
|
DatatypeInfo{..} <- reifyDatatype dType
|
||||||
|
let
|
||||||
|
matches = map mkMatch datatypeCons
|
||||||
|
mkMatch ConstructorInfo{..} = do
|
||||||
|
pats <- forM constructorFields $ \_ -> newName "x"
|
||||||
|
let fName = mkName $ "dispatch" <> nameBase constructorName
|
||||||
|
match (conP constructorName $ map varP pats) (normalB $ foldl (\e pat -> e `appE` varE pat) (varE fName) pats) []
|
||||||
|
lamCaseE matches
|
||||||
|
|||||||
Reference in New Issue
Block a user