Skip to content
Browse files

Stopped using HashSet until hashable is fixed

  • Loading branch information...
1 parent 1541a55 commit f7cd94791e6b8c81b98a7d47973bf9178e5aa852 @jystic committed Mar 14, 2013
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/Main.hs
View
13 src/Main.hs
@@ -10,7 +10,7 @@ import Data.Aeson (ToJSON(..), object, (.=), encode)
import Data.Attoparsec.ByteString.Char8
import qualified Data.ByteString.Char8 as B
import Data.Git
-import qualified Data.HashSet as H
+import Data.List ((\\))
import qualified Data.Map as M
import Data.Maybe (catMaybes, listToMaybe)
import Data.Monoid ((<>))
@@ -35,6 +35,7 @@ main = withSocketsDo $ do
config :: MonadSnap m => Config m a
config = setPort 30090
+ . setCompression False
$ defaultConfig
site :: Snap ()
@@ -72,16 +73,18 @@ process (GitDiff path refA refB) = do
repo <- openRepository path
filesA <- hashBlobs <$> getCommitFiles repo refA
filesB <- hashBlobs <$> getCommitFiles repo refB
- return $ H.map fst (H.difference filesA filesB)
+ return $ map fst (filesA \\ filesB)
-hashBlobs :: [(Text, ObjRef Blob)] -> H.HashSet (Text, Text)
-hashBlobs = H.fromList . map (second $ T.pack . showId)
+hashBlobs :: [(Text, ObjRef Blob)] -> [(Text, Text)]
+hashBlobs = map (second $ T.pack . showId)
where
showId (IdRef oid) = show oid
showId (ObjRef b) = show (getId b)
json :: ToJSON a => a -> Snap ()
-json = writeLBS . encode . toJSON
+json obj = do
+ modifyResponse (setContentType "application/json")
+ (writeLBS . encode . toJSON) obj
------------------------------------------------------------------------

0 comments on commit f7cd947

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