Jérôme Mahuet 9 سال پیش
والد
کامیت
3cbf2df173
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 4 1
      frameworks/Haskell/spock/src/Models/Fortune.hs
  2. 2 0
      frameworks/Haskell/spock/src/Models/World.hs

+ 4 - 1
frameworks/Haskell/spock/src/Models/Fortune.hs

@@ -23,20 +23,23 @@ instance ToJSON Fortune where
         [ "id"       .= _idF f
         , "message"  .= _messageF f
         ]
+    {-# INLINE toJSON #-}
 
 -- | Transforming a database row into a World datatype.
 instance FromRow Fortune where
     fromRow = Fortune <$> field <*> field
+    {-# INLINE fromRow #-}
 
 -- | For sorting purposes
 instance Eq Fortune where
     (==) fa fb =
         _idF fa      == _idF fb
      && _messageF fa == _messageF fb
+    {-# INLINE (==) #-}
 
 instance Ord Fortune where
     compare = comparing _messageF
-
+    {-# INLINE compare #-}
 
 fetchFortunes :: PG.Connection -> IO [Fortune]
 fetchFortunes c = PG.query_ c "SELECT id, message FROM Fortune"

+ 2 - 0
frameworks/Haskell/spock/src/Models/World.hs

@@ -27,10 +27,12 @@ instance ToJSON World where
         [ "id"            .= _idW w
         , "randomNumber"  .= _randomNumberW w
         ]
+    {-# INLINE toJSON #-}
 
 -- | Transforming a database row into a World datatype.
 instance FromRow World where
     fromRow = World <$> field <*> field
+    {-# INLINE fromRow #-}
 
 -- | Get a World by Id, this will return a Just World, or Nothing
 -- if the id is not in the database.