11986
Progress Journals & Experimental Routines / Re: ADARQ's journal
« on: April 03, 2016, 06:16:26 am »
it's really hard for me to sleep when I can't figure something out.. that's why I usually don't try and figure complex things out after 12 AM or so.
this simple piece of code took me 3 hours to figure out.. I was overlooking something for a lonnnnnng time.
now, i go lie down and die.
this simple piece of code took me 3 hours to figure out.. I was overlooking something for a lonnnnnng time.
Code: [Select]
q4 :: forall site.
(YesodPersist site, YesodPersistBackend site ~ SqlBackend) =>
Key Board -> HandlerT site IO [(E.Value Int64, E.Value Int64, E.Value Int64)]
q4 board_id = do
runDB
$ E.select
$ E.from $ \((thread_post :: E.SqlExpr (Entity ThreadPost)) `E.LeftOuterJoin` (thread :: E.SqlExpr (Entity
Thread)) `E.LeftOuterJoin` (board :: E.SqlExpr (Entity Board))) -> do
E.on $ thread ^. ThreadBoardId E.==. board ^. BoardId
E.on $ thread_post ^. ThreadPostThreadId E.==. thread ^. ThreadId
E.where_ $
board ^. BoardId E.==. E.val board_id
return (E.countDistinct $ board ^. BoardId, E.countDistinct $ thread ^. ThreadId, E.countDistinct $
thread_post ^. ThreadPostId)now, i go lie down and die.




