Skip to content

Commit 253c115

Browse files
authored
Merge pull request #88 from andreasabel/ghc-9.14
Cosmetics for GHC 9.14
2 parents eba83f6 + df109e0 commit 253c115

File tree

16 files changed

+84
-98
lines changed

16 files changed

+84
-98
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
strategy:
3333
matrix:
3434
include:
35+
- compiler: ghc-9.14.0.20250819
36+
compilerKind: ghc
37+
compilerVersion: 9.14.0.20250819
38+
setup-method: ghcup-prerelease
39+
allow-failure: false
3540
- compiler: ghc-9.12.2
3641
compilerKind: ghc
3742
compilerVersion: 9.12.2
@@ -126,6 +131,21 @@ jobs:
126131
HCKIND: ${{ matrix.compilerKind }}
127132
HCNAME: ${{ matrix.compiler }}
128133
HCVER: ${{ matrix.compilerVersion }}
134+
- name: Install GHC (GHCup prerelease)
135+
if: matrix.setup-method == 'ghcup-prerelease'
136+
run: |
137+
"$HOME/.ghcup/bin/ghcup" config add-release-channel prereleases
138+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
139+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
140+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
141+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
142+
echo "HC=$HC" >> "$GITHUB_ENV"
143+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
144+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
145+
env:
146+
HCKIND: ${{ matrix.compilerKind }}
147+
HCNAME: ${{ matrix.compiler }}
148+
HCVER: ${{ matrix.compilerVersion }}
129149
- name: Set PATH and environment variables
130150
run: |
131151
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
@@ -136,7 +156,7 @@ jobs:
136156
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
137157
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
138158
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
139-
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
159+
if [ $((HCNUMVER >= 91400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
140160
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
141161
env:
142162
HCKIND: ${{ matrix.compilerKind }}
@@ -164,6 +184,18 @@ jobs:
164184
repository hackage.haskell.org
165185
url: http://hackage.haskell.org/
166186
EOF
187+
if $HEADHACKAGE; then
188+
cat >> $CABAL_CONFIG <<EOF
189+
repository head.hackage.ghc.haskell.org
190+
url: https://ghc.gitlab.haskell.org/head.hackage/
191+
secure: True
192+
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
193+
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
194+
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
195+
key-threshold: 3
196+
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
197+
EOF
198+
fi
167199
cat >> $CABAL_CONFIG <<EOF
168200
program-default-options
169201
ghc-options: $GHCJOBS +RTS -M3G -RTS
@@ -215,9 +247,11 @@ jobs:
215247
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project ; fi
216248
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package happstack-server" >> cabal.project ; fi
217249
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
218-
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package happstack-server" >> cabal.project ; fi
219250
cat >> cabal.project <<EOF
220251
EOF
252+
if $HEADHACKAGE; then
253+
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
254+
fi
221255
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(happstack-server)$/; }' >> cabal.project.local
222256
cat cabal.project
223257
cat cabal.project.local

attic/Examples/AllIn.hs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Happstack.Data.IxSet
1616
import qualified Data.Map as M
1717

1818
------------------------------------------------
19-
-- Define a component of state
19+
-- Define a component of state
2020
--
2121
-- Real examples are HelpReqs, FlashMsgs, and sessions
2222
-- really you should put components in their own modules.
@@ -29,15 +29,13 @@ import qualified Data.Map as M
2929
-- Lets start with defining a simple state component: Session
3030
type SesKey = Integer
3131
type ETime = Integer
32-
newtype OldSession val = OldSession {old_unsession::[(SesKey,(ETime,val))]}
33-
deriving (Typeable)
32+
newtype OldSession val = OldSession {old_unsession::[(SesKey,(ETime,val))]}
3433

3534
instance Version (OldSession val)
3635
$(deriveSerialize ''OldSession)
3736

3837

3938
newtype Session val = Session { unsession :: M.Map SesKey (ETime,val) }
40-
deriving (Typeable)
4139

4240
instance Migrate (OldSession val) (Session val) where
4341
migrate (OldSession sess) = Session (M.fromList sess)
@@ -71,7 +69,7 @@ getSession :: SesKey -> Query (Session val) (Maybe val)
7169
getSession key = do val <- liftM (M.lookup key) askSession
7270
return (liftM snd val)
7371

74-
setSession key val = do
72+
setSession key val = do
7573
t <- getTime
7674
modSession $ M.insert key (t,val)
7775
return ()
@@ -97,30 +95,30 @@ numSessions = proxyQuery $ liftM M.size askSession
9795

9896
-- Declare these as methods. So you can access them from any IO via (query $
9997
-- GetSession key) or (update $ setSession key val). When we can have
100-
-- Data for phantom types in 6.8.2 this will look nicer
98+
-- Data for phantom types in 6.8.2 this will look nicer
10199

102-
$(mkMethods ''Session
103-
['newSession,'setSession, 'cleanSessions,'numSessions ,'getSession])
100+
$(mkMethods ''Session
101+
['newSession,'setSession, 'cleanSessions,'numSessions ,'getSession])
104102

105103
-- Sometimes you want maintenance on your component that the user
106104
-- doesn't want to worry about.
107105

108106
maintainSessions v = do update $ CleanSessions 3600000 v
109107
threadDelay (10^6 * 10) -- Once every 10 seconds
110-
maintainSessions v
108+
maintainSessions v
111109

112110
instance (Serialize a) => Component (Session a) where
113111
type Dependencies (Session a) = End
114112
initialValue = Session M.empty
115113

116-
-- All components need an atStart declaration though the list can be empty
114+
-- All components need an atStart declaration though the list can be empty
117115

118116
-- Now we repeat the above for a more trivial example so we have
119-
-- multiple components in state. But we'll use the more concise deriveAll syntax
117+
-- multiple components in state. But we'll use the more concise deriveAll syntax
120118
-- so you don't deal with the boilerplate of a zillion deriving declarations on each type.
121119

122-
data UserComponent key = UserComponent {unUserComponent :: key} deriving (Typeable)
123-
data SingletonComponent = SingletonComponent {unSingleton :: String} deriving (Typeable)
120+
data UserComponent key = UserComponent {unUserComponent :: key}
121+
data SingletonComponent = SingletonComponent {unSingleton :: String}
124122

125123
instance Version (UserComponent key)
126124
$(deriveSerialize ''UserComponent)
@@ -183,7 +181,7 @@ $(deriveAll [''Show,''Default, ''Read]
183181

184182
data State = State { privateInt :: Int
185183
, privateString :: String
186-
} deriving (Typeable)
184+
}
187185

188186
instance Version State
189187
$(deriveSerialize ''State)
@@ -227,7 +225,7 @@ impl = dir "setGet" $ msum
227225
mbComp <- getData
228226
comp <- maybe mzero return mbComp
229227
liftIO $ update $ SetComponent (comp :: Int)
230-
ok comp -- returned as <?xml v=1.0?><component>blah</component>.
228+
ok comp -- returned as <?xml v=1.0?><component>blah</component>.
231229
-- add the xslt wrapper to style the xml
232230
-- or write your own ToMessage instance for your return types
233231
]

attic/Examples/DistributedChat/DistributedChat.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module Main (main) where
44
import Happstack.State
55
import Happstack.Server
66

7-
import Data.Typeable ( Typeable )
87
import System.Environment ( getArgs, getProgName )
98
import System.Exit ( exitWith, ExitCode(ExitFailure) )
109
import Control.Monad.State ( put, get)
@@ -21,7 +20,7 @@ type MessageId = Int
2120
data User = User { userNick :: Nick
2221
, userLastSeen :: MessageId }
2322

24-
data ChatState = ChatState MessageId [ (Nick, Message, MessageId) ] deriving (Typeable)
23+
data ChatState = ChatState MessageId [ (Nick, Message, MessageId) ]
2524
instance Version ChatState
2625
$(deriveSerialize ''ChatState)
2726

@@ -73,7 +72,7 @@ main = bracket (startSystemStateMultimaster rootState) closeTxControl $ \ctl ->
7372
[ do
7473
mbUser <- getDataFn getUserFromCookie
7574
user <- maybe mzero return mbUser
76-
msum
75+
msum
7776
[ dir "send" $ do
7877
msg <- getDataFn (look "msg") >>= maybe mzero return
7978
update $ AddMessage (userNick user) msg
@@ -82,14 +81,14 @@ main = bracket (startSystemStateMultimaster rootState) closeTxControl $ \ctl ->
8281
(newLast, msgs) <- liftIO $ getMessages (userLastSeen user)
8382
addCookie (-1) (mkCookie "last" (show newLast))
8483
ok (toResponse (format msgs))
85-
84+
8685
, dir "clear" $ do
8786
addCookie (-1) (mkCookie "last" (show 0))
8887
ok (toResponse "")
8988
, fileServe [] "ChatRun.html"
9089
]
9190
, dir "login" $ do
92-
nick <- getDataFn (look "nick") >>= maybe mzero return
91+
nick <- getDataFn (look "nick") >>= maybe mzero return
9392
addCookie (-1) (mkCookie "nick" nick)
9493
addCookie (-1) (mkCookie "last" (show 0))
9594
seeOther "/" (toResponse "")

attic/Examples/MultimasterTest1.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
{-# LANGUAGE TemplateHaskell, DeriveDataTypeable, MultiParamTypeClasses, TypeFamilies, FlexibleContexts #-}
1+
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, TypeFamilies, FlexibleContexts #-}
22
module Main where
33

44
import Happstack.Server
55
import Happstack.State
66

7-
import Data.Typeable
87
import Control.Monad.State
98
import Control.Monad.Reader
109

11-
data MyState = MyState Int deriving (Typeable)
10+
data MyState = MyState Int
1211

1312
instance Version MyState
1413
$(deriveSerialize ''MyState)
@@ -42,4 +41,3 @@ main = do ctl <- startSystemStateMultimaster rootState
4241
seeOther "/" ""
4342
, do val <- query GetVal
4443
ok $ "Value is: " ++ show val ]
45-

attic/Examples/MultimasterTest2.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
{-# LANGUAGE TemplateHaskell, DeriveDataTypeable, MultiParamTypeClasses, TypeFamilies, FlexibleContexts #-}
1+
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, TypeFamilies, FlexibleContexts #-}
22
module Main where
33

44
import Happstack.Server
55
import Happstack.State
66

7-
import Data.Typeable
87
import Control.Monad.State
98
import Control.Monad.Reader
109

11-
data MyState = MyState Int deriving (Typeable)
10+
data MyState = MyState Int
1211
instance Version MyState
1312
$(deriveSerialize ''MyState)
1413

@@ -41,4 +40,3 @@ main = do ctl <- startSystemStateMultimaster rootState
4140
seeOther "/" ""
4241
, do val <- query GetVal
4342
ok $ "Value is: " ++ show val ]
44-

attic/Examples/Timer.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ module Timer where
33

44
import Happstack.State
55
import Happstack.Data
6-
import Data.Typeable
76
import Data.Generics
87
import Control.Monad.State (modify)
98
import Control.Concurrent
109

11-
newtype Timer = Timer Int deriving (Typeable)
10+
newtype Timer = Timer Int
1211
instance Version Timer
1312
$(deriveSerialize ''Timer)
1413

attic/Examples/dist-newstyle/cache/config

Lines changed: 0 additions & 38 deletions
This file was deleted.

cabal.haskell-ci

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
branches: master
2+
3+
error-incomplete-patterns: False

happstack-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Cabal-Version: >= 1.10
1313
Extra-Source-Files: tests/Happstack/Server/Tests.hs README.md
1414

1515
tested-with:
16+
GHC == 9.14.1
1617
GHC == 9.12.2
1718
GHC == 9.10.2
1819
GHC == 9.8.2

src/Happstack/Server/Cookie.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE DeriveDataTypeable, FlexibleContexts #-}
1+
{-# LANGUAGE FlexibleContexts #-}
22
-- | Functions for creating, adding, and expiring cookies. To lookup cookie values see "Happstack.Server.RqData".
33
module Happstack.Server.Cookie
44
( Cookie(..)
@@ -19,7 +19,7 @@ import Happstack.Server.Types (Response, addHeader)
1919
-- | Add the 'Cookie' to 'Response'.
2020
--
2121
-- example
22-
--
22+
--
2323
-- > main = simpleHTTP nullConf $
2424
-- > do addCookie Session (mkCookie "name" "value")
2525
-- > ok $ "You now have a session cookie."
@@ -33,7 +33,7 @@ addCookie life cookie =
3333
addHeaderM a v = composeFilter $ \res-> addHeader a v res
3434

3535
-- | Add the list 'Cookie' to the 'Response'.
36-
--
36+
--
3737
-- see also: 'addCookie'
3838
addCookies :: (MonadIO m, FilterMonad Response m) => [(CookieLife, Cookie)] -> m ()
3939
addCookies = mapM_ (uncurry addCookie)
@@ -44,5 +44,5 @@ addCookies = mapM_ (uncurry addCookie)
4444
-- > do expireCookie "name"
4545
-- > ok $ "The cookie has been expired."
4646

47-
expireCookie :: (MonadIO m, FilterMonad Response m) => String -> m ()
47+
expireCookie :: (MonadIO m, FilterMonad Response m) => String -> m ()
4848
expireCookie name = addCookie Expired (mkCookie name "")

0 commit comments

Comments
 (0)