-
Notifications
You must be signed in to change notification settings - Fork 9
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
Updates to dependencies, and small touchups in wijkanders #128
Changes from 6 commits
0dc2469
d70399d
8e0986a
e30a20c
69fca88
6a8e249
f30658c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM haskell:9.4.5 as BIN | ||
FROM haskell:9.6.4 as BIN | ||
WORKDIR /app/user | ||
COPY *.cabal ./ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
version: '3.7' | ||
|
||
services: | ||
mat: | ||
build: . | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ author: Adam Sandberg Eriksson | |
maintainer: [email protected] | ||
category: Web | ||
build-type: Simple | ||
Tested-With: GHC ==9.4.5 | ||
Tested-With: GHC ==9.6.4 | ||
data-files: | ||
static/style.css | ||
static/icon.png | ||
|
@@ -18,7 +18,7 @@ data-files: | |
static/fonts/OFL.txt | ||
|
||
library | ||
default-language: Haskell2010 | ||
default-language: GHC2021 | ||
hs-source-dirs: src | ||
ghc-options: -Wall -Werror -Wunused-binds -Wunused-imports -Wcompat | ||
exposed-modules: Model | ||
|
@@ -34,26 +34,26 @@ library | |
-- versions in the `build-depends` blocks below. | ||
build-depends: aeson >= 2.1.2.1 && < 3.0 | ||
, attoparsec >= 0.14.4 && < 0.15 | ||
, base >=4.17.1.0 && < 5.0 | ||
, base >=4.18.2.0 && < 5.0 | ||
, bytestring >=0.11 && < 0.12 | ||
, css-text >= 0.1.3.0 && < 0.2 | ||
, exceptions >= 0.10.5 && < 0.11.0 | ||
, heredoc == 0.2.0.0 | ||
, heredoc >= 0.2.0.0 && < 0.3 | ||
, logging-effect >= 1.4.0 && <= 2.0 | ||
, microlens-platform >= 0.4.3.3 && < 0.5 | ||
, lucid >= 2 && < 3 | ||
, mtl == 2.2.2 | ||
, microlens-platform >= 0.4.3.5 && < 0.5 | ||
, lucid >= 2.11.1 && < 3 | ||
, mtl >= 2.3.1 && < 2.5 | ||
, old-locale == 1.0.0.7 | ||
, prettyprinter == 1.7.1 | ||
, req >= 3.13 && < 4.0 | ||
, retry == 0.8.1.2 | ||
, safe == 0.3.19 | ||
, retry == 0.9.3.1 | ||
, safe >= 0.3.21 && < 0.4 | ||
, tagsoup == 0.14.8 | ||
, text >= 2.0 && <= 3.0 | ||
, file-embed >= 0.0.15.0 && < 1.0 | ||
, file-embed >= 0.0.16.0 && < 1.0 | ||
, thyme >= 0.4 && <= 0.5 | ||
, word8 == 0.1.3 | ||
, extra >= 1.7.10 && <= 1.8 | ||
, extra >= 1.7.16 && <= 1.8 | ||
, vector-space >= 0.16 && <0.18 | ||
|
||
executable mat-chalmers | ||
|
@@ -70,23 +70,23 @@ executable mat-chalmers | |
, mtl | ||
, req | ||
, prettyprinter | ||
, scotty >= 0.12.1 && < 0.13 | ||
, time >= 1.12 && < 1.13 | ||
, wai-extra >= 3.1.13.0 && < 4.0 | ||
, scotty >= 0.20 && < 0.30 | ||
, time >= 1.12.2 && < 1.13 | ||
, wai-extra >= 3.1.14 && < 4.0 | ||
, wai-middleware-static-embedded == 0.1.0.0 | ||
, async >= 2.2.4 && <= 3.0 | ||
default-language: Haskell2010 | ||
, async >= 2.2.5 && <= 3.0 | ||
default-language: GHC2021 | ||
|
||
Test-Suite test-mat | ||
type: exitcode-stdio-1.0 | ||
main-is: Main.hs | ||
hs-source-dirs: test | ||
default-language: Haskell2010 | ||
default-language: GHC2021 | ||
build-depends: base | ||
, bytestring | ||
, mat-chalmers | ||
, aeson >= 2.1.2.1 && < 3.0 | ||
, hspec >= 2.10.10 && < 3.0 | ||
, hspec >= 2.11.8 && < 3.0 | ||
, HUnit >= 1.6.2.0 && < 2.0 | ||
, text | ||
, thyme >= 0.3.5.5 | ||
, thyme >= 0.4 && <= 0.5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,6 @@ defaultConfig = Config False 14 (1000000 * 60 * 30) 5007 | |
-- times before it makes sense, so if you're in a hurry, look at the types. | ||
-- | ||
-- TODO: Feel free to bikeshed the function name. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not enough bikesheding 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tehee ;P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much better! |
||
reifyConfig | ||
recreateConfig | ||
:: ([Config -> Config], [String], [String]) -> (Config, [String], [String]) | ||
reifyConfig = (& _1 %~ foldl' (flip id) defaultConfig) | ||
recreateConfig = _1 %~ foldl' (flip id) defaultConfig |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module Model.Wijkanders | ||
( getWijkanders | ||
, hasDate | ||
|
@@ -8,6 +9,7 @@ import Control.Arrow ( (***) | |
, (&&&) | ||
, (>>>) | ||
) | ||
import Control.Monad ( (<=<) ) | ||
import Data.Attoparsec.ByteString.Lazy ( maybeResult | ||
, parse | ||
, skip | ||
|
@@ -21,6 +23,7 @@ import qualified Data.ByteString.Lazy as BL | |
import qualified Data.ByteString.Lazy.Char8 as BL8 | ||
import Data.Maybe ( mapMaybe ) | ||
import Data.Text.Encoding.Error ( ignore ) | ||
import Data.Text.Encoding ( encodeUtf8 ) | ||
import Data.Text.Lazy.Encoding ( decodeUtf8With ) | ||
import Data.Thyme ( Day | ||
, Days | ||
|
@@ -53,10 +56,10 @@ import Util ( menusToEitherNoLunch | |
-- ..and gives them in another order to play nice with the | ||
-- YearMonthDay constructor. | ||
hasDate :: ByteString -> Maybe (Months, Days) | ||
hasDate = maybeResult . parse ((\d m -> (m, d)) <$> parseDay <*> parseMonth) | ||
hasDate = maybeResult . parse (flip (,) <$> parseDay <*> parseMonth) | ||
where | ||
parseDay = skipMany (skip (not . W8.isDigit)) *> integerParser | ||
parseMonth = string (B8.pack "/") *> integerParser | ||
parseMonth = string (encodeUtf8 "/") *> integerParser | ||
integerParser = fmap (read . B8.unpack) (takeWhile1 W8.isDigit) | ||
|
||
-- | getWijkanders will either give you a list of menus or NoLunch. | ||
|
@@ -74,23 +77,21 @@ getWijkanders d = | |
) | ||
>>> takeWhile | ||
(not . tagText | ||
(\s -> BL.isPrefixOf (BL8.pack "Med reservation") s || maybe | ||
False | ||
(> d) | ||
( hasDate s | ||
>>= ( gregorianValid | ||
. uncurry (YearMonthDay $ ymdYear $ view gregorian d) | ||
) | ||
) | ||
) | ||
(or . ([ | ||
BL.isPrefixOf (BL8.pack "Med reservation") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We love indentation |
||
, maybe False (> d) . | ||
( gregorianValid | ||
. uncurry (YearMonthDay $ ymdYear $ view gregorian d) | ||
<=< hasDate) | ||
] <*>) . pure) | ||
) | ||
|
||
-- The heading is of no use to us. | ||
>>> drop 1 | ||
>>> dropWhile (~/= "<strong>") | ||
>>> dropWhile (~/= ("<strong>" :: String)) | ||
>>> removeWhitespaceTags | ||
>>> partitions (~== "<strong>") | ||
>>> mapMaybe ((maybeTagText =<<) . (`atMay` 1)) | ||
>>> partitions (~== ("<strong>" :: String)) | ||
>>> mapMaybe (maybeTagText <=< (`atMay` 1)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty! |
||
>>> map | ||
( BL.break (== W8._colon) | ||
>>> ( decodeUtf8With ignore | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to see this removed as it is now obsolete.