Skip to content
Browse files

Update CUFP2011 tutorial example to latest versions of dependencies.

  • Loading branch information...
1 parent bc716ce commit 1707a7d0972b67d7629f893a5bf8ef09d767ba78 @gregorycollins gregorycollins committed
View
5 sample-implementation/Snap/Chat/API/Handlers.hs
@@ -11,7 +11,6 @@ import Control.Monad
import Control.Monad.CatchIO
import Control.Monad.Reader
import Data.Aeson
-import Data.Aeson.Encode
import Data.Attoparsec hiding (try)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as S
@@ -20,7 +19,7 @@ import Data.Char
import qualified Data.Text as T
import Prelude hiding (catch)
import Snap.Iteratee (($$), consume, joinI, takeNoMoreThan)
-import Snap.Types
+import Snap.Core
import System.PosixCompat.Time
import Web.ClientSession
------------------------------------------------------------------------------
@@ -74,7 +73,7 @@ apiCall f = method POST $ do
Success a -> do
output <- f a
modifyResponse $ setContentType "application/json"
- writeBuilder $ fromValue $ toJSON output)
+ writeLBS $ encode $ toJSON output)
parseResult
where
maxSize = 131072 -- 128 kB should be enough for anybody
View
4 sample-implementation/Snap/Chat/Internal/API/Types.hs
@@ -8,10 +8,10 @@ import Control.Monad.Reader
import Data.Aeson
import qualified Data.Aeson.Types as A
import Data.ByteString.Char8 (ByteString)
-import qualified Data.Map as Map
+import qualified Data.HashMap.Strict as Map
import Data.Text (Text)
import qualified Data.Text as T
-import Snap.Types
+import Snap.Core
import System.Posix.Types
------------------------------------------------------------------------------
import Snap.Chat.Internal.Types
View
2 sample-implementation/Snap/Chat/Internal/Types.hs
@@ -14,7 +14,7 @@ import qualified Data.Aeson.Types as A
import Data.ByteString (ByteString)
import Data.Data
import qualified Data.HashTable.IO as HT
-import qualified Data.Map as Map
+import qualified Data.HashMap.Strict as Map
import Data.Monoid
import Data.Text (Text)
import System.Posix.Types
View
26 snap-chat.cabal
@@ -1,5 +1,5 @@
Name: snap-chat
-Version: 0.1
+Version: 0.2
License: BSD3
License-file: LICENSE
Author: Gregory Collins
@@ -27,8 +27,8 @@ Executable snap-chat
Main-is: Snap/Chat/Main.hs
Build-depends: base >= 4.2 && < 5,
- aeson >= 0.3 && < 0.4,
- attoparsec >= 0.9 && < 0.10,
+ aeson >= 0.5 && < 0.6,
+ attoparsec >= 0.10 && < 0.11,
base16-bytestring >= 0.1 && < 0.2,
bytestring >= 0.9 && < 0.10,
clientsession >= 0.7 && < 0.8,
@@ -37,11 +37,12 @@ Executable snap-chat
MonadCatchIO-transformers >= 0.2 && <0.3,
mtl >= 2.0 && < 3.0,
mwc-random >= 0.10 && < 0.11,
- snap-core >= 0.5.3 && < 0.6,
- snap-server >= 0.5.3 && < 0.6,
+ snap-core >= 0.7 && < 0.8,
+ snap-server >= 0.7 && < 0.8,
stm >= 2.2 && < 2.3,
text >= 0.11 && < 0.12,
- unix-compat >= 0.2 && < 0.4
+ unix-compat >= 0.2 && < 0.4,
+ unordered-containers >= 0.1.4 && < 0.2
ghc-options: -O2 -Wall -fwarn-tabs -funbox-strict-fields -threaded
-fno-warn-unused-do-bind
@@ -53,8 +54,8 @@ Executable snap-chat-sample
Main-is: Snap/Chat/Main.hs
Build-depends: base >= 4.2 && < 5,
- aeson >= 0.3 && < 0.4,
- attoparsec >= 0.9 && < 0.10,
+ aeson >= 0.5 && < 0.6,
+ attoparsec >= 0.10 && < 0.11,
base16-bytestring >= 0.1 && < 0.2,
bytestring >= 0.9 && < 0.10,
clientsession >= 0.7 && < 0.8,
@@ -63,12 +64,13 @@ Executable snap-chat-sample
MonadCatchIO-transformers >= 0.2 && <0.3,
mtl >= 2.0 && < 3.0,
mwc-random >= 0.10 && < 0.11,
- snap-core >= 0.5.3 && < 0.6,
- snap-server >= 0.5.3 && < 0.6,
+ snap-core >= 0.7 && < 0.8,
+ snap-server >= 0.7 && < 0.8,
stm >= 2.2 && < 2.3,
text >= 0.11 && < 0.12,
- unix-compat >= 0.2 && < 0.4
+ unix-compat >= 0.2 && < 0.4,
+ unordered-containers >= 0.1.4 && < 0.2
ghc-options: -O2 -Wall -fwarn-tabs -funbox-strict-fields -threaded
-fno-warn-unused-do-bind
-
+
View
4 src/Snap/Chat/Internal/API/Types.hs
@@ -8,10 +8,10 @@ import Control.Monad.Reader
import Data.Aeson
import qualified Data.Aeson.Types as A
import Data.ByteString.Char8 (ByteString)
-import qualified Data.Map as Map
+import qualified Data.HashMap.Strict as Map
import Data.Text (Text)
import qualified Data.Text as T
-import Snap.Types
+import Snap.Core
import System.Posix.Types
------------------------------------------------------------------------------
import Snap.Chat.Internal.Types
View
2 src/Snap/Chat/Main.hs
@@ -5,8 +5,8 @@ module Main where
import Snap.Chat.API.Handlers
import Snap.Chat.ChatRoom
import Snap.Chat.Types
+import Snap.Core
import Snap.Http.Server
-import Snap.Types
import Snap.Util.FileServe
import Web.ClientSession
View
21 test/snap-chat-testsuite.cabal
@@ -12,17 +12,17 @@ Executable testsuite
HUnit >= 1.2 && < 2,
QuickCheck >= 2.3.0.2 && < 3.0,
MonadCatchIO-transformers >= 0.2 && < 0.3,
- aeson >= 0.3 && < 0.4,
- attoparsec >= 0.9 && < 0.10,
+ aeson >= 0.5 && < 0.6,
+ attoparsec >= 0.10 && < 0.11,
base16-bytestring >= 0.1 && < 0.2,
bytestring >= 0.9 && < 0.10,
clientsession >= 0.7 && < 0.8,
containers >= 0.4 && < 0.5,
- deepseq >= 1.1 && < 1.2,
+ deepseq >= 1.1 && < 1.3,
hashtables >= 1.0 && < 1.1,
mtl >= 2 && < 3,
mwc-random >= 0.10 && < 0.11,
- snap-core >= 0.5.3 && < 0.6,
+ snap-core >= 0.7 && < 0.8,
stm >= 2.2 && < 2.3,
test-framework >= 0.4 && < 0.5,
test-framework-hunit >= 0.2.5 && < 0.3,
@@ -43,24 +43,25 @@ Executable testsuite-sample
HUnit >= 1.2 && < 2,
QuickCheck >= 2.3.0.2 && < 3.0,
MonadCatchIO-transformers >= 0.2 && < 0.3,
- aeson >= 0.3 && < 0.4,
- attoparsec >= 0.9 && < 0.10,
+ aeson >= 0.5 && < 0.6,
+ attoparsec >= 0.10 && < 0.11,
base16-bytestring >= 0.1 && < 0.2,
bytestring >= 0.9 && < 0.10,
clientsession >= 0.7 && < 0.8,
containers >= 0.4 && < 0.5,
- deepseq >= 1.1 && < 1.2,
+ deepseq >= 1.1 && < 1.3,
hashtables >= 1.0 && < 1.1,
mtl >= 2 && < 3,
mwc-random >= 0.10 && < 0.11,
- snap-core >= 0.5.3 && < 0.6,
+ snap-core >= 0.7 && < 0.8,
stm >= 2.2 && < 2.3,
test-framework >= 0.4 && < 0.5,
test-framework-hunit >= 0.2.5 && < 0.3,
test-framework-quickcheck2 >= 0.2.6 && < 0.3,
text >= 0.11 && < 0.12,
- unix-compat >= 0.2 && < 0.4
+ unix-compat >= 0.2 && < 0.4,
+ unordered-containers >= 0.1 && < 0.2
ghc-options: -O2 -Wall -fhpc -fwarn-tabs -funbox-strict-fields -threaded
-fno-warn-unused-do-bind
-
+
View
2 test/suite/Snap/Chat/Internal/API/Tests.hs
@@ -12,7 +12,7 @@ import Data.Aeson.Types
import qualified Data.Attoparsec as A
import qualified Data.ByteString.Char8 as S
import qualified Data.ByteString.Lazy.Char8 as L
-import qualified Data.Map as Map
+import qualified Data.HashMap.Strict as Map
import Data.Maybe (isJust)
import Data.Text (Text)
import Test.Framework

0 comments on commit 1707a7d

Please sign in to comment.
Something went wrong with that request. Please try again.