Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6807449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:50:02+00:00 2026-05-26T19:50:02+00:00

>main :: IO () main = withPostgresqlConn host=localhost user=Rocko port=5432 dbname=Rocko $ runSqlConn $

  • 0
>main :: IO ()
 main = withPostgresqlConn "host=localhost user=Rocko port=5432 dbname=Rocko" $           runSqlConn $ do
   runMigration migrateAll
   let compDay = C.fromGregorian 2011 11 21
   match <- selectList
              [TestStartDate ==. compDay,
               TestEstimatedEnd ==. compDay,
               TestStatus /<-. [Passed,Failed]] []
   scheduled <- selectList [TestStatus ==. Scheduled] []
--   liftIO $ print scheduled
   liftIO $ print match
   if (L.null match == True) then (liftIO $ print "date available!!!! ") else (liftIO $       print "date not available")
   return ()

I’m trying to determine if a particular Day meets this criteria: is not equal to a TestStartDate, is not equal to a TestEstimatedEnd, and neither Passed not Failed is a member of TestStatus.

However, I want to demonstrate that with the date I picked (which should have a match on an TestEstimatedEnd) fails to do the right thing. It should say , :date not available. So what is wrong with my logic?

> id |         firmware          |  version   | startDate  | estimatedEnd |  status

>----+---------------------------+------------+------------+--------------+-----------
  >1 | BCC Admin                 | 0.0.00.001 | 2011-11-19 | 2011-11-21   | Scheduled

>ghcifoo> main
 "date available!!!! "
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:50:02+00:00Added an answer on May 26, 2026 at 7:50 pm

    This is a difficult problem to replicate so what I’m writing is a pretty wild guess, but here goes:

    Lets work backwards from the final result

    if (L.null match == True) then (liftIO $ print "date available!!!! ") else (liftIO $       print "date not available")
    

    This line clearly evaluated the then condition. Ergo (L.null match == True) was True. My first question is why the == True clause? L.null match should work just as well by itself.

    Now we know that L.null match must have been True, but the line above would seem to indicate that match contains one record. So at this point I would suspect that L.null is perhaps not the function you think it is or match doesn’t contain what the output is leading us to believe it does. My next debugging suggestion would be to test match against some other properties (is there a length function maybe?) and see if the problem is with L.null or match. Another thought is to move the print statement after the if. That should not change anything (certainly not in Haskell!), but the response from a database query is occasionally weird. (e.g. not a list but a stream of results that gets consumed as they are used.)

    Good Luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The main user-case is: Create the 2D floor plan See the 3D view of
Main Problem : Get rid of # when user clicks on anchor tag. I
Main problem: how do i group elements by their Date, only if continuous and
main() { printf(Hello World.); } Why does no warning is produced in gcc compiler
main() { char a,b,c; a=6; b=-5; c = a+b ; printf (%d %d %d
main.c (with all the headers like stdio, stdlib, etc): int main() { int input;
The main web application of my company is crying out for a nifty set
My main JavaScript framework is jQuery , so I would like my unit test
function main() { Hello(); } function Hello() { // How do you find out
Why main must be declared as if it has external linkage? Why it should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.