on master help sign in
17 files changed+185−270
since splitsnapshots
unifiedsplit
LICENSE Procfile Setup.hs app.json app/Main.hs+4−11 docs.md docs/Docs.hs+23−23 package.yaml−4 readme.md+67−80 src/Data/CyclicBuffer.hs src/Data/Error.hs src/Foo/Data.hs+78−135 src/Lib.hs+10−12 src/Network/Bacon.hs stack.yaml+2−4 swagger/Swagger.hs+1−1 test/Spec.hs
LICENSEmode 100644 → 100755

Only the mode changed.

Procfilemode 100644 → 100755

Only the mode changed.

Setup.hsmode 100644 → 100755

Only the mode changed.

app.jsonmode 100644 → 100755

Only the mode changed.

app/Main.hsmode 100644 → 100755+4−11
@@ -1,5 +1,3 @@
1−-- {-# LANGUAGE OverloadedStrings #-}
2−
31module Main where
42
53import Network.Wai.Handler.Warp (run)
@@ -7,17 +5,12 @@ import Servant.Server (serve)
75import System.Environment
86import Lib
97import Network.Wai.Middleware.Cors
10−import Database.Beam.Postgres (connectPostgreSQL)
11−import Data.Maybe
12−import qualified Data.ByteString.Char8 as B
138
149main :: IO ()
1510main = do
16− mPort <- lookupEnv "PORT"
17− let port = maybe 2000 read mPort :: Int
11+ env <- lookupEnv "PORT"
12+ let port = maybe 2000 read env :: Int
1813 putStrLn $ "Starting on port: " ++ show port
19− mDatabaseURL <- lookupEnv "DATABASE_URL"
20− let databaseURL = fromMaybe "host=localhost port=5432 dbname=postgres connect_timeout=10" mDatabaseURL
21− conn <- connectPostgreSQL $ B.pack databaseURL
22− srv <- createServer conn
14+ print env
15+ srv <- createServer
2316 run port $ simpleCors $ serve server srv
docs.mdmode 100644 → 100755

Only the mode changed.

docs/Docs.hsmode 100644 → 100755+23−23
@@ -19,34 +19,34 @@ import Data.Foldable (fold)
1919import Servant.API.WebSocket
2020import Control.Lens
2121
22−main = return () -- writeFile "docs.md" . markdown . docs . pretty $ server
22+main = writeFile "docs.md" . markdown . docs . pretty $ server
2323
24−-- -- instance ToSample User
25−-- instance ToCapture (Capture "first" T.Text) where
26−-- toCapture _ = DocCapture "first" "The first name of the user."
24+-- instance ToSample User
25+instance ToCapture (Capture "first" T.Text) where
26+ toCapture _ = DocCapture "first" "The first name of the user."
2727
28−-- instance ToSample Foo.Data.Post where
29−-- toSamples _ = samples $ Post `fmap` [1, 4, 7, 194] <*> [4, 7, 92] <*> ["This is the post body", "This is another post body"]
28+instance ToSample Foo.Data.Post where
29+ toSamples _ = samples $ Post `fmap` [1, 4, 7, 194] <*> [4, 7, 92] <*> ["This is the post body", "This is another post body"]
3030
31−-- instance ToSample User where
32−-- toSamples _ = samples [
33−-- User (UserName "Seva" "Leonidovich") 1,
34−-- User (UserName "Foo" "Barovich") 42,
35−-- User (UserName "Bar" "Fooovich") 69,
36−-- User (UserName "Qux" "Quixovich") 8]
31+instance ToSample User where
32+ toSamples _ = samples [
33+ User (UserName "Seva" "Leonidovich") 1,
34+ User (UserName "Foo" "Barovich") 42,
35+ User (UserName "Bar" "Fooovich") 69,
36+ User (UserName "Qux" "Quixovich") 8]
3737
38−-- instance ToCapture (Capture "second" T.Text) where
39−-- toCapture _ = DocCapture "second" "The second name of the user."
38+instance ToCapture (Capture "second" T.Text) where
39+ toCapture _ = DocCapture "second" "The second name of the user."
4040
41−-- instance ToSample (TokenizedResponse [Foo.Data.Post]) where
42−-- toSamples _ = samples $ TokenizedResponse `fmap` [1, 46, 193, 7] <*> [map snd $ toSamples (Proxy :: Proxy Foo.Data.Post)]
41+instance ToSample (TokenizedResponse [Foo.Data.Post]) where
42+ toSamples _ = samples $ TokenizedResponse `fmap` [1, 46, 193, 7] <*> [map snd $ toSamples (Proxy :: Proxy Foo.Data.Post)]
4343
44−-- instance ToCapture (Capture "id" Int) where
45−-- toCapture _ = DocCapture "id" "The id of the entity you want to query."
44+instance ToCapture (Capture "id" Int) where
45+ toCapture _ = DocCapture "id" "The id of the entity you want to query."
4646
47−-- instance ToCapture (Capture "token" Int) where
48−-- toCapture _ = DocCapture "token" "The token, recieved wit the previuos request"
47+instance ToCapture (Capture "token" Int) where
48+ toCapture _ = DocCapture "token" "The token, recieved wit the previuos request"
4949
50−-- instance HasDocs WebSocketPending where
51−-- docsFor Proxy (endpoint, action) =
52−-- docsFor (Proxy :: Proxy Raw) (endpoint, action & notes <>~ [DocNote "title" ["not title"]])
50+instance HasDocs WebSocketPending where
51+ docsFor Proxy (endpoint, action) =
52+ docsFor (Proxy :: Proxy Raw) (endpoint, action & notes <>~ [DocNote "title" ["not title"]])
package.yamlmode 100644 → 100755−4
@@ -37,10 +37,6 @@ dependencies:
3737- websockets
3838- lens
3939- wai-cors
40−- beam-core
41−- beam-postgres
42−- postgresql-simple
43−- random-shuffle
4440
4541library:
4642 source-dirs: src
readme.mdmode 100644 → 100755+67−80
@@ -6,10 +6,6 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
66
77## GET /posts/all
88
9−_start with: [`https://websuck1t.herokuapp.com/posts/all`](https://websuck1t.herokuapp.com/posts/all)_
10−
11−Use this _url_ to get the token every time when application begins and previous session was closed
12−
139### Response:
1410
1511- Status code 200
@@ -59,19 +55,82 @@ Use this _url_ to get the token every time when application begins and previous
5955}
6056```
6157
62−### Response fields
58+## GET /users/:id
59+
60+Retrieves a user with the given `id`.
61+
62+#### If there is no user with the given `id`, the method returns error `404`.
63+
64+### Captures:
65+
66+- *id*: The id of the entity you want to query.
6367
64−- "token" to further use it in subscription to web socket
65−- "response" to start with the given number of posts in table
68+### Response:
69+
70+- Status code 200
71+- Headers: []
72+
73+- Supported content types are:
74+
75+ - `application/json`
76+
77+- Example (`application/json`):
78+
79+```javascript
80+{
81+ "userName": {
82+ "secondName": "Leonidovich",
83+ "firstName": "Seva"
84+ },
85+ "userId": 1
86+}
87+```
88+
89+- Example (`application/json`):
90+
91+```javascript
92+{
93+ "userName": {
94+ "secondName": "Barovich",
95+ "firstName": "Foo"
96+ },
97+ "userId": 42
98+}
99+```
100+
101+- Example (`application/json`):
102+
103+```javascript
104+{
105+ "userName": {
106+ "secondName": "Fooovich",
107+ "firstName": "Bar"
108+ },
109+ "userId": 69
110+}
111+```
112+
113+- Example (`application/json`):
114+
115+```javascript
116+{
117+ "userName": {
118+ "secondName": "Quixovich",
119+ "firstName": "Qux"
120+ },
121+ "userId": 8
122+}
123+```
66124
67125## WebSocket /posts/subscribe/:token
68126
69127You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
70128
71−Open a web socket from the given `token` for receiving events about new and deleted posts with `ws://websuck1t.herokuapp.com/posts/subscribe/{token}`
129+Open a web socket from the given `token` for receiving events about new and deleted posts.
72130
73131#### Returns error `498` if the supplied token has expired or is invalid.
74132
133+
75134### Captures:
76135
77136- *token*: The token, received with the previous request.
@@ -98,8 +157,6 @@ Open a web socket from the given `token` for receiving events about new and dele
98157
99158## GET /posts/:id
100159
101−_url: [`https://websuck1t.herokuapp.com/posts/{id}`](https://websuck1t.herokuapp.com/posts/1)_
102−
103160#### If there is no post with the given `id`, the method returns error `404`.
104161
105162### Captures:
@@ -164,73 +221,3 @@ _url: [`https://websuck1t.herokuapp.com/posts/{id}`](https://websuck1t.herokuapp
164221 "postId": 1
165222}
166223```
167−
168−
169−## GET /users/:id
170−
171−_url: [`https://websuck1t.herokuapp.com/users/{id}`](https://websuck1t.herokuapp.com/users/1)_
172−
173−Retrieves a user with the given `id`.
174−
175−#### If there is no user with the given `id`, the method returns error `404`.
176−
177−### Captures:
178−
179−- *id*: The id of the entity you want to query.
180−
181−### Response:
182−
183−- Status code 200
184−- Headers: []
185−
186−- Supported content types are:
187−
188− - `application/json`
189−
190−- Example (`application/json`):
191−
192−```javascript
193−{
194− "userName": {
195− "secondName": "Leonidovich",
196− "firstName": "Seva"
197− },
198− "userId": 1
199−}
200−```
201−
202−- Example (`application/json`):
203−
204−```javascript
205−{
206− "userName": {
207− "secondName": "Barovich",
208− "firstName": "Foo"
209− },
210− "userId": 42
211−}
212−```
213−
214−- Example (`application/json`):
215−
216−```javascript
217−{
218− "userName": {
219− "secondName": "Fooovich",
220− "firstName": "Bar"
221− },
222− "userId": 69
223−}
224−```
225−
226−- Example (`application/json`):
227−
228−```javascript
229−{
230− "userName": {
231− "secondName": "Quixovich",
232− "firstName": "Qux"
233− },
234− "userId": 8
235−}
236−```
src/Data/CyclicBuffer.hsmode 100644 → 100755

Only the mode changed.

src/Data/Error.hsmode 100644 → 100755

Only the mode changed.

src/Foo/Data.hsmode 100644 → 100755+78−135
@@ -1,12 +1,5 @@
11{-# LANGUAGE DeriveGeneric #-}
2−{-# LANGUAGE GADTs #-}
32{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE FlexibleContexts #-}
5−{-# LANGUAGE FlexibleInstances #-}
6−{-# LANGUAGE TypeFamilies #-}
7−{-# LANGUAGE TypeApplications #-}
8−{-# LANGUAGE MultiParamTypeClasses #-}
9−
103
114module Foo.Data
125 (
@@ -16,6 +9,7 @@ module Foo.Data
169 createApp,
1710 createConfig,
1811 User(..),
12+ UserName(..),
1913 Config,
2014 updates,
2115 allUsers,
@@ -56,12 +50,6 @@ import qualified Data.CyclicBuffer as CB
5650import Data.Set ((\\), union)
5751import Data.Monoid
5852import Debug.Trace
59−import Database.Beam
60−import qualified Database.Beam.Postgres as P
61−import Database.Beam.Query
62−import Database.PostgreSQL.Simple (withTransaction)
63−import Database.Beam.Backend.SQL.BeamExtensions
64−import System.Random.Shuffle
6553
6654type App = ReaderT Config Handler
6755
@@ -69,35 +57,35 @@ class HasConfig c where
6957 getCfg :: c -> Config
7058
7159allUsers :: App [User]
72−allUsers = asks dbConn >>= \conn -> liftIO . P.runBeamPostgres conn . runSelectReturningList . select . all_ . users $ socialDb
60+allUsers = ask >>= liftIO . fmap M.elems . readTVarIO . users
7361
7462post :: PostId -> App Post
7563post pId = do
76− conn <- asks dbConn
77− u <- liftIO . P.runBeamPostgres conn . runSelectReturningOne . flip lookup_ (PostId pId) . posts $ socialDb
64+ cfg <- ask
65+ u <- liftIO . atomically . fmap (M.lookup pId) . readTVar . posts $ cfg
7866 case u of
7967 Just u -> return u
8068 Nothing -> throwError err404
8169
8270user :: UserId -> App User
8371user uId = do
84− conn <- asks dbConn
85− u <- liftIO . P.runBeamPostgres conn . runSelectReturningOne . flip lookup_ (UserId uId) . users $ socialDb
72+ cfg <- ask
73+ u <- liftIO . atomically . fmap (M.lookup uId) . readTVar . users $ cfg
8674 case u of
8775 Just u -> return u
8876 Nothing -> throwError err404
8977
90−allPosts :: App [Post]
91−allPosts = asks dbConn >>= \conn -> liftIO . P.runBeamPostgres conn . runSelectReturningList . select . all_ . posts $ socialDb
78+allPosts :: App (STM [Post])
79+allPosts = asks $ fmap M.elems . readTVar . posts
9280
9381getToken :: App (STM Token)
9482getToken = asks $ fmap CB.lastToken . readTVar . updates
9583
96−createConfig :: P.Connection -> IO Config
97−createConfig conn = do
84+createConfig :: IO Config
85+createConfig = do
9886 mng <- newManager tlsManagerSettings
99− cfg <- atomically $ Config <$> return conn <*> return mng <*> newTVar M.empty <*> newTVar 0 <*> newTVar (CB.empty 20)
100− forkIO . forever $ threadDelay 7000000 >> (runHandler . createApp cfg $ startAddingPosts 25 cfg >>= uncurry sendUpdate)
87+ cfg <- atomically $ Config <$> newTVar 0 <*> newTVar 0 <*> newTVar M.empty <*> newTVar M.empty <*> return mng <*> newTVar M.empty <*> newTVar 0 <*> newTVar (CB.empty 20)
88+ forkIO . forever $ threadDelay 2000000 >> (runHandler . createApp cfg $ startAddingPosts 20 cfg >>= uncurry sendUpdate)
10189 return cfg
10290
10391type Token = Int
@@ -151,7 +139,10 @@ type PostId = Int
151139type ConnectionId = Int
152140
153141data Config = Config {
154− dbConn :: P.Connection,
142+ lastUserID :: TVar UserId,
143+ lastPostID :: TVar PostId,
144+ users :: TVar (M.Map Int User),
145+ posts :: TVar (M.Map Int Post),
155146 manager :: Manager,
156147 connections :: TVar (M.Map ConnectionId Connection),
157148 lastConnection :: TVar ConnectionId,
@@ -161,56 +152,42 @@ data Config = Config {
161152instance HasConfig Config where
162153 getCfg = id
163154
155+-- startAddingUsers :: Config -> App ()
156+-- startAddingUsers cfg = do
157+-- a <- liftIO $ loremBacon (manager cfg) (Just AllMeat) (Just 2) (Just False)
158+-- let t = fromMaybe ["None", "None"] a
159+-- liftIO . atomically $ newUser cfg (t !! 0) (t !! 1)
160+-- return ()
161+
164162startAddingPosts :: Int -> Config -> App (Token, Update)
165163startAddingPosts lim cfg = do
166164 cfg <- ask
167− let conn = dbConn cfg
168− -- let us = users socialDb
169− -- let ps = posts socialDb
165+ let us = users cfg
166+ let ps = posts cfg
170167
171168 a <- liftIO $ loremBacon (manager cfg) (Just AllMeat) (Just lim) (Just 0)
172169 g <- liftIO newStdGen
173170 let rns = randoms g
174−
175− let t = fromMaybe (repeat "None") a
176−
177− let deleteCount = 3
178171
179− (deletedIds, addedIds) <- join . liftIO . withTransaction conn . return $ do
180− userIds <- liftIO . P.runBeamPostgres conn . runSelectReturningList . select $ do
181− uc <- all_ . users $ socialDb
182− pure (userId uc)
183−
184− if length userIds <= 0 then return ([],[])
185− else do
186− postIds <- liftIO . P.runBeamPostgres conn . runSelectReturningList . select $ do
187− uc <- all_ . posts $ socialDb
188− pure (postId uc)
189−
190−
191− let postCount = length postIds
192− let toDeleteIndecies = take deleteCount $ shuffle' postIds postCount g
193−
194− let toAdd = max 0 $ lim - length postIds + length toDeleteIndecies
195−
196− -- Just deletedPost <- liftIO . P.runBeamPostgres conn . runSelectReturningOne . select . limit_ 1 . offset_ (fromIntegral $ toDeleteIndex - 1) . all_ . posts $ socialDb
197− -- let deletedId = postId deletedPost
198−
199− unless (length toDeleteIndecies <= 0) $
200− liftIO . P.runBeamPostgres conn . runDelete $
201− delete (posts socialDb) ((`in_` map val_ toDeleteIndecies) . postId)
202−
203− nIds <- liftIO . P.runBeamPostgres conn . runInsertReturningList (posts socialDb) $ insertExpressions $ take toAdd . flip map (zip rns t) $ \(r, t) -> Post default_ (val_ (userIds %! r)) (val_ t)
204−
205− return (toDeleteIndecies, map postId nIds)
206−
207− liftIO . atomically $ do
208− let upd = Update (S.fromList addedIds) (S.fromList deletedIds)
209− let uppT = updates cfg
210− upp <- readTVar uppT
211− let (token, upp') = CB.insert upp upd
212− writeTVar uppT upp'
213− return (token, upd)
172+ let t = fromMaybe (repeat "None") a
173+ liftIO . atomically $ do
174+ uu <- readTVar us
175+ let uSize = M.size uu
176+ if uSize >= 1 then do
177+ pp <- readTVar ps
178+ let toDeleteIndex = head rns `mod` M.size pp
179+ let deletedKey = fst $ M.elemAt toDeleteIndex pp
180+ dd <- if M.size pp > 0 then writeTVar ps (M.deleteAt toDeleteIndex pp) >> return [deletedKey]
181+ else return []
182+ let toAdd = max 0 $ lim - (M.size pp - 1)
183+ add <- fmap (map postId) $ forM (zip rns $ take toAdd t) $ \(rnd, t) -> newPost cfg (randomFrom rnd uu) t
184+ let upd = Update (S.fromList add) (S.fromList dd)
185+ let uppT = updates cfg
186+ upp <- readTVar uppT
187+ let (token, upp') = CB.insert upp upd
188+ writeTVar uppT upp'
189+ return (token, upd)
190+ else return (0, mempty)
214191
215192sendUpdate :: Token -> Update -> App ()
216193sendUpdate t u = do
@@ -219,84 +196,50 @@ sendUpdate t u = do
219196 liftIO $ forM conns $ flip sendTextData $ encode $ TokenizedResponse t u
220197 return ()
221198
222−modIndex :: [a] -> Int -> a
223−modIndex aa i = aa !! (i `mod` length aa)
224−
225−infixl 5 %!
226−(%!) = modIndex
227−
228−
229199randomFrom :: Int -> M.Map k v -> k
230200randomFrom g as = M.keys as !! (abs g `mod` M.size as)
231201
232−newUser :: Config -> Text -> Text -> IO [User]
202+newUser :: Config -> Text -> Text -> STM User
233203newUser cfg first second = do
234− let conn = dbConn cfg
235− P.runBeamPostgres conn . runInsertReturningList (users socialDb) $ insertExpressions [User default_ (val_ first) (val_ second)]
236−
237−
238−-- newPost :: Config -> UserId -> Text -> STM Post
239−-- newPost cfg user body = do
240−-- let lastId = lastPostID cfg
241−-- let ps = posts cfg
242−-- do
243−-- id <- readTVar lastId
244−-- writeTVar lastId (id+1)
245−-- let p = Post id user body
246−-- modifyTVar ps $ M.insert id p
247−-- return p
248−
249−data UserT f = User {
250− userId :: Columnar f UserId,
251− firstName :: Columnar f Text,
252− secondName :: Columnar f Text
204+ let lastID = lastUserID cfg
205+ let us = users cfg
206+ do
207+ id <- readTVar lastID
208+ writeTVar lastID (id+1)
209+ let user = User (UserName first second) id
210+ oldUsers <- readTVar us
211+ writeTVar us $ M.insert id user oldUsers
212+ return user
213+
214+newPost :: Config -> UserId -> Text -> STM Post
215+newPost cfg user body = do
216+ let lastId = lastPostID cfg
217+ let ps = posts cfg
218+ do
219+ id <- readTVar lastId
220+ writeTVar lastId (id+1)
221+ let p = Post id user body
222+ modifyTVar ps $ M.insert id p
223+ return p
224+
225+data User = User {
226+ userName :: UserName,
227+ userId :: UserId
253228} deriving Generic
254229
255−instance Beamable UserT
256−
257−type User = UserT Identity
258−
259−instance Table UserT where
260− data PrimaryKey UserT f = UserId (Columnar f UserId)
261− deriving Generic
262−
263− primaryKey = UserId . userId
264−
265−instance Beamable (PrimaryKey UserT)
266−
267−data PostT f = Post {
268− postId :: Columnar f PostId,
269− postAuthor :: Columnar f UserId,
270− postBody :: Columnar f Text
230+data Post = Post {
231+ postId :: PostId,
232+ postAuthor :: UserId,
233+ postBody :: Text
271234} deriving Generic
272235
273−instance Beamable PostT
274−
275−type Post = PostT Identity
276−
277236instance ToJSON User
278237instance ToJSON Post
279238
280−instance Table PostT where
281− data PrimaryKey PostT f = PostId (Columnar f PostId)
282− deriving Generic
283−
284− primaryKey = PostId . postId
285−
286−instance Beamable (PrimaryKey PostT)
287−
288−data SocialDb f = SocialDb {
289− users :: f (TableEntity UserT),
290− posts :: f (TableEntity PostT)
291−} deriving Generic
239+data UserName = UserName {
240+ firstName :: Text,
241+ secondName :: Text
242+} deriving (Generic)
292243
293−instance Database be SocialDb
244+instance ToJSON UserName
294245
295−socialDb :: DatabaseSettings be SocialDb
296−socialDb = defaultDbSettings `withDbModification`
297− dbModification {
298− users = modifyTable id $ tableModification {
299− firstName = "firstname",
300− secondName = "secondname"
301− }
302− }
src/Lib.hsmode 100644 → 100755+10−12
@@ -1,7 +1,6 @@
11{-# LANGUAGE DataKinds #-}
22{-# LANGUAGE TypeOperators #-}
33{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE ScopedTypeVariables #-}
54
65module Lib
76 ( server,
@@ -27,7 +26,7 @@ import Data.Aeson
2726import qualified Data.Set as S
2827import Data.CyclicBuffer
2928import Data.Foldable (fold)
30−import qualified Database.Beam.Postgres as P
29+
3130
3231type API = "users" :> Capture "id" UserId :> Get '[JSON] User
3332 :<|> "users" :> "add" :> Capture "first" Text :> Capture "second" Text :> Get '[JSON] [User]
@@ -36,14 +35,13 @@ type API = "users" :> Capture "id" UserId :> Get '[JSON] User
3635 :<|> "posts" :> "all" :> Get '[JSON] (TokenizedResponse [D.Post])
3736 :<|> "posts" :> "subscribe" :> Capture "token" Int :> WebSocketPending
3837
39−createServer :: P.Connection -> IO (Server API)
40−createServer pConn = do
41− cfg <- createConfig pConn
42− -- newUser cfg "Kostya" "Designerovich"
43− -- newUser cfg "Anna" "Androidovna"
44− -- newUser cfg "Darya" "Aiphonovna"
45− -- newUser cfg "Ilya" "Serverovich"
46− -- newUser cfg "Константин" "Дудосерович"
38+createServer :: IO (Server API)
39+createServer = do
40+ cfg <- createConfig
41+ atomically $ newUser cfg "Kostya" "Designerovich"
42+ atomically $ newUser cfg "Anna" "Androidovna"
43+ atomically $ newUser cfg "Darya" "Aiphonovna"
44+ atomically $ newUser cfg "Ilya" "Serverovich"
4745 return $ hoistServer server (createApp cfg) serverAPI
4846
4947server :: Proxy API
@@ -61,14 +59,14 @@ serverAPI =
6159createUserPath :: Text -> Text -> App [User]
6260createUserPath first second = do
6361 cfg <- ask
64− liftIO $ newUser cfg first second
62+ liftIO . atomically $ newUser cfg first second
6563 allUsers
6664
6765returnPosts :: App (TokenizedResponse [D.Post])
6866returnPosts = do
6967 posts <- allPosts
7068 t <- getToken
71− liftIO $ atomically $ TokenizedResponse <$> t <*> pure posts
69+ liftIO $ atomically $ TokenizedResponse <$> t <*> posts
7270
7371invalidTokenError :: RejectRequest
7472invalidTokenError = defaultRejectRequest {
src/Network/Bacon.hsmode 100644 → 100755

Only the mode changed.

stack.yamlmode 100644 → 100755+2−4
@@ -17,7 +17,7 @@
1717#
1818# resolver: ./custom-snapshot.yaml
1919# resolver: https://example.com/snapshots/2018-01-01.yaml
20−resolver: lts-12.25
20+resolver: lts-13.1
2121
2222# User packages to be built.
2323# Various formats can be used as shown in the example below.
@@ -37,9 +37,7 @@ packages:
3737# Dependency packages to be pulled from upstream that are not in the resolver
3838# using the same syntax as the packages field.
3939# (e.g., acme-missiles-0.3)
40−extra-deps:
41−- beam-core-0.7.2.2
42−- beam-postgres-0.3.2.2
40+# extra-deps: []
4341
4442# Override default flag values for local packages and extra-deps
4543# flags: {}
swagger/Swagger.hsmode 100644 → 100755+1−1
@@ -19,6 +19,6 @@ import Data.Aeson
1919import qualified Data.ByteString.Lazy as BS
2020
2121instance ToSchema User
22−-- instance ToSchema UserName
22+instance ToSchema UserName
2323
2424main = return () -- BS.writeFile "swag.txt" . encode . toSwagger $ server
test/Spec.hsmode 100644 → 100755

Only the mode changed.